Fix RAISE NOTICE syntax in migration error handler

Use parameterized RAISE NOTICE with %L placeholders instead of trying to
concatenate strings inside quoted literals. This fixes the syntax error where
|| operators were being treated as string content instead of SQL operators.
This commit is contained in:
Marc Rejohn Castillano 2026-03-20 18:30:19 +08:00
parent 20720ba541
commit d81e2cde26

View File

@ -509,7 +509,7 @@ BEGIN
EXCEPTION WHEN others THEN
RAISE NOTICE 'pg_cron/pg_net not available. After enabling them, run these manually:';
RAISE NOTICE ' SELECT cron.schedule("notification_enqueue_every_min", "*/1 * * * *", $QUERY$SELECT public.enqueue_all_notifications();$QUERY$);';
RAISE NOTICE ' SELECT cron.schedule("notification_process_every_min", "*/1 * * * *", $QUERY$SELECT public.process_notification_queue();$QUERY$);';
RAISE NOTICE ' SELECT cron.schedule("cleanup_old_notifications", "0 3 * * *", $QUERY$DELETE FROM scheduled_notifications WHERE processed = true AND processed_at < now() - interval ' || quote_literal('7 days') || '; DELETE FROM notification_pushes WHERE pushed_at < now() - interval ' || quote_literal('7 days') || ';$QUERY$);';
RAISE NOTICE ' SELECT cron.schedule(%L, %L, %L);', 'notification_enqueue_every_min', '*/1 * * * *', 'SELECT public.enqueue_all_notifications();';
RAISE NOTICE ' SELECT cron.schedule(%L, %L, %L);', 'notification_process_every_min', '*/1 * * * *', 'SELECT public.process_notification_queue();';
RAISE NOTICE ' SELECT cron.schedule(%L, %L, %L);', 'cleanup_old_notifications', '0 3 * * *', 'DELETE FROM scheduled_notifications WHERE processed = true AND processed_at < now() - interval ' || quote_literal('7 days') || '; DELETE FROM notification_pushes WHERE pushed_at < now() - interval ' || quote_literal('7 days') || ';';
END $$;