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
# Connect as supabase_admin and create the extension
514
+
withhost.sudo("postgres"):
515
+
result=host.run('psql -U supabase_admin -d postgres -c "CREATE EXTENSION pg_cron WITH SCHEMA pg_catalog VERSION \'1.3.1\';"')
516
+
assertresult.rc==0, f"Failed to create pg_cron extension: {result.stderr}"
517
+
518
+
# Create test table
519
+
result=host.run('psql -U supabase_admin -d postgres -c "CREATE TABLE cron_test_log (id SERIAL PRIMARY KEY, message TEXT, log_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP);"')
520
+
assertresult.rc==0, f"Failed to create test table: {result.stderr}"
521
+
522
+
# Schedule a job
523
+
result=host.run('psql -U supabase_admin -d postgres -c "SELECT cron.schedule(\'* * * * *\', \'INSERT INTO cron_test_log (message) VALUES (\\\'Hello from pg_cron!\\\');\');"')
524
+
assertresult.rc==0, f"Failed to schedule job: {result.stderr}"
525
+
assert"1"inresult.stdout, "Expected schedule ID 1"
526
+
527
+
# Verify job is scheduled
528
+
result=host.run('psql -U supabase_admin -d postgres -c "SELECT * FROM cron.job;"')
529
+
assertresult.rc==0, f"Failed to query cron.job: {result.stderr}"
0 commit comments