summaryrefslogtreecommitdiffstats
path: root/standalone/src/main/assembly/resources/bin/initDB.sh
diff options
context:
space:
mode:
Diffstat (limited to 'standalone/src/main/assembly/resources/bin/initDB.sh')
-rw-r--r--standalone/src/main/assembly/resources/bin/initDB.sh50
1 files changed, 23 insertions, 27 deletions
diff --git a/standalone/src/main/assembly/resources/bin/initDB.sh b/standalone/src/main/assembly/resources/bin/initDB.sh
index 06d2bfc8..a7ee1eed 100644
--- a/standalone/src/main/assembly/resources/bin/initDB.sh
+++ b/standalone/src/main/assembly/resources/bin/initDB.sh
@@ -15,36 +15,32 @@
# limitations under the License.
#
-DIRNAME=`dirname $0`
-HOME=`cd $DIRNAME/; pwd`
+echo "setting database init parameters"
+main_path="/home/uui"
user=$1
password=$2
-port=$3
-host=$4
-echo "start create usecase-ui db"
-sql_path=$HOME/../
-mysql -u$user -p$password -P$port -h$host <$sql_path/dbscripts/mysql/usecase-ui-createdb.sql
+host=$3
+port=$4
+dbname=$5
+
+echo "start create usecase-ui database..."
+dbscripts_path="$main_path/resources/dbscripts/postgres"
+psql "host=$host port=$port user=$user password=$password dbname=$dbname" -f $dbscripts_path/uui_create_db.sql
sql_result=$?
-if [ $sql_result != 0 ] ; then
- echo "failed to create usecase-ui database"
+if [ $sql_result!=0 ] then
+ echo "failed to create usecase-ui database!"
exit 1
+else
+ echo "usecase-ui database created successfully!"
fi
-fileFlag=*createobj.sql
-location=$sql_path/dbscripts/mysql
-fileName=""
-for i in `ls $location`
-do
- if [[ $i == ${fileFlag} ]];then
- fileName=${i};
- echo "start create table:${fileName}"
- mysql -u$user -p$password -P$port -h$host <$sql_path/dbscripts/mysql/$fileName
- sql_result=$?
- if [ $sql_result != 0 ] ; then
- echo "failed to init usecase-ui table:${fileName}"
- exit 1
- fi
- fi
-done
-echo "init usecase-ui database success!"
-exit 0
+echo "start create usecase-ui tables..."
+psql "host=$host port=$port user=$user password=$password dbname=$dbname" -f $dbscripts_path/uui_create_table.sql
+sql_result=$?
+if [ $sql_result!=0 ] then
+ echo "failed to create usecase-ui table!"
+ exit 1
+else
+ echo "usecase-ui tables created successfully!"
+fi
+exit 0