From 166691c7bfcf21896a0c0375166f00f8dd78e1cc Mon Sep 17 00:00:00 2001 From: Nick Larsen Date: Thu, 16 Jan 2025 14:35:12 +0100 Subject: [PATCH] fix(stack/end-to-end-security): Skip DB restore if the DB exists Otherwise it breaks with: ``` ERROR [flask_migrate] Error: Requested revision 17fcea065655 overlaps with other requested revisions b7851ee5522f ``` The latter revision being the one that exists in the uploaded dump. --- stacks/end-to-end-security/superset.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stacks/end-to-end-security/superset.yaml b/stacks/end-to-end-security/superset.yaml index f5ca1ff3..e1bb378f 100644 --- a/stacks/end-to-end-security/superset.yaml +++ b/stacks/end-to-end-security/superset.yaml @@ -46,6 +46,11 @@ spec: - bash - -c - | + if psql --host postgresql-superset --user postgres --csv -c "SELECT datname FROM pg_database where datname = 'superset' limit 1" | grep -q superset; then + # The flask app will do any necesary migrations. + echo "Skip restoring the DB as it already exists" + exit 0 + fi psql --host postgresql-superset --user postgres < /dump/postgres_superset_dump.sql env: - name: PGPASSWORD