From 09599ad2be81a93f998974ee9ee3a8d13ffaacf2 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Thu, 12 Sep 2024 12:10:57 +0100 Subject: [PATCH] fix: run timescaledb_pre/post_restore() --- .../pg_upgrade_scripts/common.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ansible/files/admin_api_scripts/pg_upgrade_scripts/common.sh b/ansible/files/admin_api_scripts/pg_upgrade_scripts/common.sh index e776982ae..97b5c7828 100755 --- a/ansible/files/admin_api_scripts/pg_upgrade_scripts/common.sh +++ b/ansible/files/admin_api_scripts/pg_upgrade_scripts/common.sh @@ -93,6 +93,14 @@ begin; create role supabase_tmp superuser; set session authorization supabase_tmp; +do $$ +begin + if exists (select from pg_extension where extname = 'timescaledb') then + execute(format('select %I.timescaledb_pre_restore()', (select pronamespace::regnamespace from pg_proc where proname = 'timescaledb_pre_restore'))); + end if; +end +$$; + do $$ declare postgres_rolpassword text := (select rolpassword from pg_authid where rolname = 'postgres'); @@ -493,6 +501,14 @@ begin end $$; +do $$ +begin + if exists (select from pg_extension where extname = 'timescaledb') then + execute(format('select %I.timescaledb_post_restore()', (select pronamespace::regnamespace from pg_proc where proname = 'timescaledb_post_restore'))); + end if; +end +$$; + set session authorization supabase_admin; drop role supabase_tmp; commit;