3 # Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 echo "setting database init parameters"
25 echo "setting postgres database password"
27 psql --command "alter user $user_pg with password '$user_pg';"
30 echo "start create usecase-ui database..."
31 dbscripts_path="$main_path/resources/dbscripts/postgres"
32 psql "host=$host port=$port user=$user_pg password=$user_pg dbname=$user_pg" -f $dbscripts_path/uui_create_db.sql
34 if [ $sql_result -ne 0 ]; then
35 echo "failed to create usecase-ui database!"
38 echo "usecase-ui database created successfully!"
41 echo "start create usecase-ui tables..."
42 psql "host=$host port=$port user=$user_uui password=$user_uui dbname=$user_uui" -f $dbscripts_path/uui_create_table.sql
44 if [ $sql_result -ne 0 ]; then
45 echo "failed to create usecase-ui table!"
48 echo "usecase-ui tables created successfully!"
51 echo "start insert initial data into uui-server database..."
52 psql "host=$host port=$port user=$user_uui password=$user_uui dbname=$user_uui" -f $dbscripts_path/uui_init_data.sql
54 if [ $sql_result -ne 0 ]; then
55 echo "failed to insert initial data!"
58 echo "usecase-ui database initial data import succeed!"