aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/policy/resources/config/db_migrator_pg_policy_init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/policy/resources/config/db_migrator_pg_policy_init.sh')
-rw-r--r--kubernetes/policy/resources/config/db_migrator_pg_policy_init.sh23
1 files changed, 17 insertions, 6 deletions
diff --git a/kubernetes/policy/resources/config/db_migrator_pg_policy_init.sh b/kubernetes/policy/resources/config/db_migrator_pg_policy_init.sh
index 53921ab751..15a6e3224f 100644
--- a/kubernetes/policy/resources/config/db_migrator_pg_policy_init.sh
+++ b/kubernetes/policy/resources/config/db_migrator_pg_policy_init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
{{/*
-# Copyright (C) 2022 Nordix Foundation.
+# Copyright (C) 2022, 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,19 @@
# 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-pg -s ${SQL_DB} -o upgrade
-rc=$?
-/opt/app/policy/bin/db-migrator-pg -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-pg -s ${schema} -o report
+
+ /opt/app/policy/bin/db-migrator-pg -s ${schema} -o upgrade
+ rc=$?
+
+ /opt/app/policy/bin/db-migrator-pg -s ${schema} -o report
+
+ if [ "$rc" != 0 ]; then
+ break
+ fi
+done