mirror of
https://github.com/block/buzz.git
synced 2026-10-30 05:51:46 +00:00
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>
23 lines
1020 B
SQL
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;
|