summaryrefslogtreecommitdiff
path: root/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh
diff options
context:
space:
mode:
Diffstat (limited to 'turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh')
-rwxr-xr-xturbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh b/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh
index 62d9e53..bf27da0 100755
--- a/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh
+++ b/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh
@@ -244,11 +244,13 @@ which mkvirtualenv
set +x
# Restore database to known good state
-echo "Restoring test database $DB_NAME"
+echo "Loading test database $DB_NAME"
set -x
-mysql -u $DB_USER --password=$DB_PASS -e "drop database $DB_NAME"
-mysql -u $DB_USER --password=$DB_PASS -e "create database $DB_NAME"
-mysql -u $DB_USER --password=$DB_PASS $DB_NAME < $DATASET_SEED_SQL
+if ! mysql -u $DB_USER --password=$DB_PASS -e 'use $DB_NAME'
+then
+ mysql -u $DB_USER --password=$DB_PASS -e "create database $DB_NAME"
+ mysql -u $DB_USER --password=$DB_PASS $DB_NAME < $DATASET_SEED_SQL
+fi
set +x
echo "Build test environment"