diff --git a/scripts/helm/db/install.sh b/scripts/helm/db/install.sh index 15ff75a3b..e0c719ee8 100644 --- a/scripts/helm/db/install.sh +++ b/scripts/helm/db/install.sh @@ -79,7 +79,7 @@ for file in $(ls *.sql); do echo -e ${green}${bold}Restoring $file ${reset} kubectl exec postgresql-postgresql-0 -- /bin/bash -c "rm -rf /tmp/$file" kubectl cp $file postgresql-postgresql-0:/tmp/ - kubectl exec postgresql-postgresql-0 -- /bin/bash -c "PGPASSWORD=asayerPostgres psql -U postgres -f /tmp/$file" &> $cwd/postgresql_init.log + kubectl exec postgresql-postgresql-0 -- /bin/bash -c "PGPASSWORD=asayerPostgres psql -v ON_ERROR_STOP=1 -U postgres -f /tmp/$file" &> $cwd/postgresql_init.log echo -e ${green}${bold}Done ✔${reset} done cd $cwd diff --git a/scripts/helm/db/postgresql/README.md b/scripts/helm/db/postgresql/README.md index 8cdb2ca13..21a04c876 100755 --- a/scripts/helm/db/postgresql/README.md +++ b/scripts/helm/db/postgresql/README.md @@ -689,7 +689,7 @@ This operation could take some time depending on the database size. - Once you have the backup file, you can restore it with a command like the one below: ```console -$ psql -U postgres DATABASE_NAME < /tmp/backup.sql +$ psql -v ON_ERROR_STOP=1 -U postgres DATABASE_NAME < /tmp/backup.sql ``` In this case, you are accessing to the local postgresql, so the password should be the new one (you can find it in NOTES.txt). diff --git a/scripts/helm/migration.yaml b/scripts/helm/migration.yaml index abd4e571a..d3d5f4c80 100644 --- a/scripts/helm/migration.yaml +++ b/scripts/helm/migration.yaml @@ -18,7 +18,7 @@ file="{{ item|basename }}" kubectl exec -n db postgresql-postgresql-0 -- /bin/bash -c "rm -rf /tmp/$file" kubectl cp -n db {{ item }} postgresql-postgresql-0:/tmp/ - kubectl exec -n db postgresql-postgresql-0 -- /bin/bash -c "PGPASSWORD=asayerPostgres psql -U postgres -f /tmp/$file" &> "{{ playbook_dir }}"/postgresql_init.log + kubectl exec -n db postgresql-postgresql-0 -- /bin/bash -c "PGPASSWORD=asayerPostgres psql -v ON_ERROR_STOP=1 -U postgres -f /tmp/$file" &> "{{ playbook_dir }}"/postgresql_init.log args: chdir: db/init_dbs/postgresql with_fileglob: "{{ db_path }}" diff --git a/scripts/helmcharts/databases/charts/postgresql/README.md b/scripts/helmcharts/databases/charts/postgresql/README.md index 8cdb2ca13..21a04c876 100755 --- a/scripts/helmcharts/databases/charts/postgresql/README.md +++ b/scripts/helmcharts/databases/charts/postgresql/README.md @@ -689,7 +689,7 @@ This operation could take some time depending on the database size. - Once you have the backup file, you can restore it with a command like the one below: ```console -$ psql -U postgres DATABASE_NAME < /tmp/backup.sql +$ psql -v ON_ERROR_STOP=1 -U postgres DATABASE_NAME < /tmp/backup.sql ``` In this case, you are accessing to the local postgresql, so the password should be the new one (you can find it in NOTES.txt). diff --git a/scripts/helmcharts/openreplay/files/postgresql.sh b/scripts/helmcharts/openreplay/files/postgresql.sh index a641e4650..f2e89b6bd 100644 --- a/scripts/helmcharts/openreplay/files/postgresql.sh +++ b/scripts/helmcharts/openreplay/files/postgresql.sh @@ -17,13 +17,13 @@ function migrate() { IFS=',' read -r -a migration_versions <<< "$1" for version in ${migration_versions[*]}; do echo "Migrating postgresql version $version" - psql -f ${pgdir}/${version}/${version}.sql 2>&1 + psql -v ON_ERROR_STOP=1 -f ${pgdir}/${version}/${version}.sql 2>&1 done } function init() { echo "Initializing postgresql" - psql -f ${pgdir}/init_schema.sql 2>&1 + psql -v ON_ERROR_STOP=1 -f ${pgdir}/init_schema.sql 2>&1 } # /bin/bash postgresql.sh migrate $migration_versions