Files
buzz/migrations/0053_owner_deletion_auto_approval.sql
Codex c5edf47ca0 Merge current main into owner deletion foundation
Preserve current main migration 0052 and resequence the unchanged owner auto-approval migration as 0053.

Full verification gates remain deferred pending the recorded environment diagnosis.

Signed-off-by: Codex <codex@openai.com>
2026-09-29 01:01:30 +00:00

23 lines
1020 B
SQL

-- Owner-origin deletion requests may be prepared automatically by the
-- privileged one-shot deletion drain. Manual approvals retain operator
-- provenance and the existing exact inventory-digest foreign key.
SET LOCAL lock_timeout = '5s';
ALTER TABLE community_deletion_approvals
ADD COLUMN approval_origin TEXT NOT NULL DEFAULT 'operator'
CHECK (approval_origin IN ('operator', 'owner_automatic'));
ALTER TABLE community_deletion_requests
DROP CONSTRAINT community_deletion_requests_retry_stage_check,
ADD CONSTRAINT community_deletion_requests_retry_stage_check
CHECK (retry_stage IS NULL OR retry_stage IN (
'submitted', 'approved', 'fenced', 'drained', 'bindings_removed',
'postgres_purged', 'cache_purged', 'logically_verified'
));
CREATE INDEX community_deletion_requests_owner_preparable
ON community_deletion_requests (next_attempt_at, created_at)
WHERE request_origin = 'owner'
AND stage = 'submitted'
AND blocked_at IS NULL;