From be6150278ad87a1096df914954e76b99222b9eb8 Mon Sep 17 00:00:00 2001 From: yangyan Date: Wed, 3 Apr 2019 11:02:53 +0800 Subject: fix database bug Change-Id: Ic96e3627b74f6be61710358777e2499f77a5c63a Issue-ID: VFC-1334 Signed-off-by: yangyan --- docker/instance_init.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docker') diff --git a/docker/instance_init.sh b/docker/instance_init.sh index d6ddbf60..f789a972 100755 --- a/docker/instance_init.sh +++ b/docker/instance_init.sh @@ -23,9 +23,9 @@ function migrate_database { python manage.py migrate } -cd /service -if [ ! -f dbexist.txt ]; then - echo 1 > dbexist.txt +GET_CATALOG_DB="show databases like 'nfvocatalog';" +CATALOG_DB=`mysql -u$MYSQL_ROOT_USER -p$MYSQL_ROOT_PASSWORD -P$MYSQL_PORT -h$MYSQL_IP -e "GET_CATALOG_DB"` +if [[ "$CATALOG_DB" == "" ]]; then create_database migrate_database fi -- cgit 1.2.3-korg