From da354b8e6ca8abbb34c34d7f2c41d6aa480aa5c6 Mon Sep 17 00:00:00 2001 From: "arnaud.morvan@camptocamp.com" Date: Mon, 19 Jan 2026 18:17:42 +0100 Subject: [PATCH 1/2] Also copy alembic_revision in publish --- thinkhazard/processing/publish.py | 2 +- thinkhazard/scripts/reset-schemas | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/thinkhazard/processing/publish.py b/thinkhazard/processing/publish.py index 44602179..8ed26c30 100644 --- a/thinkhazard/processing/publish.py +++ b/thinkhazard/processing/publish.py @@ -79,7 +79,7 @@ def do_execute(self): LOG.info("Restore backup into public database") run( - "pg_restore --exit-on-error --no-owner -n datamart -n processing -f - '{backup}'" + "pg_restore --exit-on-error --no-owner -t public.alembic_version -n datamart -n processing -f - '{backup}'" " | {reset_schemas} 'datamart processing'" " | psql --single-transaction -d {database}".format( backup=LOCAL_BACKUP_PATH, diff --git a/thinkhazard/scripts/reset-schemas b/thinkhazard/scripts/reset-schemas index e0829ab1..3fea225b 100755 --- a/thinkhazard/scripts/reset-schemas +++ b/thinkhazard/scripts/reset-schemas @@ -7,6 +7,7 @@ SCHEMAS="$1" for schema in ${SCHEMAS} do cat < Date: Tue, 20 Jan 2026 14:34:49 +0100 Subject: [PATCH 2/2] Move table alembic_revision --- alembic.ini | 3 +++ thinkhazard/processing/publish.py | 2 +- thinkhazard/scripts/reset-schemas | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/alembic.ini b/alembic.ini index 58eb2618..20064b9d 100644 --- a/alembic.ini +++ b/alembic.ini @@ -3,6 +3,9 @@ [DEFAULT] # path to migration scripts script_location = alembic +version_table_schema = datamart + +# docker compose run --rm thinkhazard psql -c 'ALTER TABLE public.alembic_version SET SCHEMA datamart'; [admin] type = admin diff --git a/thinkhazard/processing/publish.py b/thinkhazard/processing/publish.py index 8ed26c30..44602179 100644 --- a/thinkhazard/processing/publish.py +++ b/thinkhazard/processing/publish.py @@ -79,7 +79,7 @@ def do_execute(self): LOG.info("Restore backup into public database") run( - "pg_restore --exit-on-error --no-owner -t public.alembic_version -n datamart -n processing -f - '{backup}'" + "pg_restore --exit-on-error --no-owner -n datamart -n processing -f - '{backup}'" " | {reset_schemas} 'datamart processing'" " | psql --single-transaction -d {database}".format( backup=LOCAL_BACKUP_PATH, diff --git a/thinkhazard/scripts/reset-schemas b/thinkhazard/scripts/reset-schemas index 3fea225b..e0829ab1 100755 --- a/thinkhazard/scripts/reset-schemas +++ b/thinkhazard/scripts/reset-schemas @@ -7,7 +7,6 @@ SCHEMAS="$1" for schema in ${SCHEMAS} do cat <