From a64a0a663281a49ed513e46cfb27a36a763eaa65 Mon Sep 17 00:00:00 2001 From: Nick Larsen Date: Thu, 16 Jan 2025 14:35:12 +0100 Subject: [PATCH 1/2] 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 0577245e..547e1c0e 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 From a23fb8746a561914fbbe88a37a7bfab891722abc Mon Sep 17 00:00:00 2001 From: Nick <10092581+NickLarsenNZ@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:23:03 +0100 Subject: [PATCH 2/2] Fix typo --- stacks/end-to-end-security/superset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stacks/end-to-end-security/superset.yaml b/stacks/end-to-end-security/superset.yaml index 547e1c0e..09ea404f 100644 --- a/stacks/end-to-end-security/superset.yaml +++ b/stacks/end-to-end-security/superset.yaml @@ -47,7 +47,7 @@ spec: - -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. + # The flask app will do any necessary migrations. echo "Skip restoring the DB as it already exists" exit 0 fi