You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ansible/files/admin_api_scripts/pg_upgrade_scripts/complete.sh
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,28 @@ EOF
48
48
49
49
run_sql -c "$PG_NET_GRANT_QUERY"
50
50
fi
51
+
52
+
# Patching pg_cron ownership as it resets during upgrade
53
+
HAS_PG_CRON_OWNED_BY_POSTGRES=$(run_sql -A -t -c "select count(*) > 0 from pg_extension where extname = 'pg_cron' and extowner::regrole::text = 'postgres';")
54
+
55
+
if [ "$HAS_PG_CRON_OWNED_BY_POSTGRES"="t" ];then
56
+
RECREATE_PG_CRON_QUERY=$(cat <<EOF
57
+
begin;
58
+
create temporary table cron_job as select * from cron.job;
59
+
create temporary table cron_job_run_details as select * from cron.job_run_details;
60
+
drop extension pg_cron;
61
+
create extension pg_cron schema pg_catalog;
62
+
insert into cron.job select * from cron_job;
63
+
insert into cron.job_run_details select * from cron_job_run_details;
64
+
select setval('cron.jobid_seq', coalesce(max(jobid), 0) + 1, false) from cron.job;
65
+
select setval('cron.runid_seq', coalesce(max(runid), 0) + 1, false) from cron.job_run_details;
66
+
update cron.job set username = 'postgres' where username = 'supabase_admin';
0 commit comments