-- name: PurgeNotifications :execrows -- Delivered and given-up notifications; pending ones are still being worked. DELETE FROM notifications WHERE status IN ('sent', 'failed') AND created_at < $1; -- name: PurgeInvitations :execrows DELETE FROM invitations WHERE expires_at < $1 OR accepted_at < $1; -- name: PurgeExpiredTokens :execrows DELETE FROM api_tokens WHERE expires_at < $1; -- name: PurgeIncidents :execrows -- Incidents resolved before the oldest data still charted. DELETE FROM incidents WHERE resolved_at < $1;