aboutsummaryrefslogtreecommitdiffstats
path: root/compose/config/db-migrator/init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'compose/config/db-migrator/init.sh')
-rwxr-xr-xcompose/config/db-migrator/init.sh19
1 files changed, 13 insertions, 6 deletions
diff --git a/compose/config/db-migrator/init.sh b/compose/config/db-migrator/init.sh
index 047d947e..a8eb25a3 100755
--- a/compose/config/db-migrator/init.sh
+++ b/compose/config/db-migrator/init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# ============LICENSE_START====================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021, 2024 Nordix Foundation.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,14 +22,21 @@ export SQL_USER=${MYSQL_USER}
export SQL_PASSWORD=${MYSQL_PASSWORD}
export SCRIPT_DIRECTORY=sql
-/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB}
+for schema in ${SQL_DB}; do
+ echo "Initializing $schema..."
+ /opt/app/policy/bin/prepare_upgrade.sh ${schema}
-/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report
+ /opt/app/policy/bin/db-migrator -s ${schema} -o report
-/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade
-rc=$?
+ /opt/app/policy/bin/db-migrator -s ${schema} -o upgrade
+ rc=$?
-/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report
+ /opt/app/policy/bin/db-migrator -s ${schema} -o report
+
+ if [ "$rc" != 0 ]; then
+ break
+ fi
+done
nc -l -p 6824