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;