aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/policy/resources/config/db_migrator_policy_init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/policy/resources/config/db_migrator_policy_init.sh')
-rw-r--r--kubernetes/policy/resources/config/db_migrator_policy_init.sh25
1 files changed, 19 insertions, 6 deletions
diff --git a/kubernetes/policy/resources/config/db_migrator_policy_init.sh b/kubernetes/policy/resources/config/db_migrator_policy_init.sh
index d1cc108fec..a1d8fd89ea 100644
--- a/kubernetes/policy/resources/config/db_migrator_policy_init.sh
+++ b/kubernetes/policy/resources/config/db_migrator_policy_init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
{{/*
-# 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.
@@ -14,8 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
-/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB}
-/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade
-rc=$?
-/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report
-exit $rc
+
+for schema in ${SQL_DB}; do
+ echo "Initializing $schema..."
+ /opt/app/policy/bin/prepare_upgrade.sh ${schema}
+
+ /opt/app/policy/bin/db-migrator -s ${schema} -o report
+
+ /opt/app/policy/bin/db-migrator -s ${schema} -o upgrade
+ rc=$?
+
+ /opt/app/policy/bin/db-migrator -s ${schema} -o report
+
+ if [ "$rc" != 0 ]; then
+ break
+ fi
+done
+
+exit $rc \ No newline at end of file