Refs #63 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
14 lines
528 B
SQL
14 lines
528 B
SQL
-- 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;
|