diff options
author | shentao999 <shentao@chinamobile.com> | 2019-04-10 14:38:03 +0800 |
---|---|---|
committer | zhangab <zhanganbing@chinamobile.com> | 2019-04-10 14:46:32 +0800 |
commit | 8e96605c2a4301a7c8e7bb5b1a2a4bc0b26daa34 (patch) | |
tree | c58d0fe88a627daa9e04f92dee8229adc539b7a8 /standalone/src/main/assembly/resources/bin/initDB.sh | |
parent | acdda859b080784e3c02cc8b3c31ef0ef3f2847e (diff) |
Change database to postgreSQL9.5
Change-Id: I859d0ae4173d41e1055d88518aac0f9a7f50d01a
Issue-ID: USECASEUI-236
Signed-off-by: zhangab <zhanganbing@chinamobile.com>
Diffstat (limited to 'standalone/src/main/assembly/resources/bin/initDB.sh')
-rw-r--r-- | standalone/src/main/assembly/resources/bin/initDB.sh | 50 |
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 |