Spaces:
Running on Zero

ats-engine / scripts /retention_cleanup.sql
aseemlais's picture
feat(extraction): complete phases 1-5 modernization with async queues, shadow evaluation, canary cutover routing, and evaluation tooling
2cdd95e
Raw History Blame Contribute Delete
626 Bytes
-- retention_cleanup.sql
-- Description: Data retention policy for completed/failed jobs (default 30 days) to prevent PII accumulation
-- Schema: ai_chatbot
-- Option 1: Manual Runbook Execution (run periodically in Supabase SQL editor):
DELETE FROM ai_chatbot."ExtractionJobs"
WHERE "createdAt" < NOW() - INTERVAL '30 days';
-- Option 2: pg_cron (if pg_cron extension is enabled in your Supabase project):
-- SELECT cron.schedule(
-- 'cleanup-extraction-jobs-nightly',
-- '0 3 * * *', -- Nightly at 3:00 AM UTC
-- $$DELETE FROM ai_chatbot."ExtractionJobs" WHERE "createdAt" < NOW() - INTERVAL '30 days'$$
-- );