fix(encryptid): drop CHECK constraint before migrating authority values
The old constraint rejected new values during UPDATE. Must drop first, migrate data, then add new constraint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4c44eb9941
commit
a2d01ed3ad
|
|
@ -457,6 +457,9 @@ CREATE INDEX IF NOT EXISTS idx_legacy_identities_pubkey ON legacy_identities(leg
|
||||||
-- MIGRATION: Rename authority verticals (voting/moderation/curation/treasury/membership → gov-ops/fin-ops/dev-ops)
|
-- MIGRATION: Rename authority verticals (voting/moderation/curation/treasury/membership → gov-ops/fin-ops/dev-ops)
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|
||||||
|
-- Drop old CHECK constraint first so UPDATEs can set new values
|
||||||
|
ALTER TABLE delegations DROP CONSTRAINT IF EXISTS delegations_authority_check;
|
||||||
|
|
||||||
-- Migrate existing delegation data
|
-- Migrate existing delegation data
|
||||||
UPDATE delegations SET authority = 'gov-ops' WHERE authority IN ('voting', 'moderation');
|
UPDATE delegations SET authority = 'gov-ops' WHERE authority IN ('voting', 'moderation');
|
||||||
UPDATE delegations SET authority = 'fin-ops' WHERE authority = 'treasury';
|
UPDATE delegations SET authority = 'fin-ops' WHERE authority = 'treasury';
|
||||||
|
|
@ -472,6 +475,5 @@ UPDATE trust_events SET authority = 'gov-ops' WHERE authority IN ('voting', 'mod
|
||||||
UPDATE trust_events SET authority = 'fin-ops' WHERE authority = 'treasury';
|
UPDATE trust_events SET authority = 'fin-ops' WHERE authority = 'treasury';
|
||||||
UPDATE trust_events SET authority = 'dev-ops' WHERE authority IN ('curation', 'membership');
|
UPDATE trust_events SET authority = 'dev-ops' WHERE authority IN ('curation', 'membership');
|
||||||
|
|
||||||
-- Update CHECK constraint on delegations table
|
-- Add new CHECK constraint with updated values
|
||||||
ALTER TABLE delegations DROP CONSTRAINT IF EXISTS delegations_authority_check;
|
|
||||||
ALTER TABLE delegations ADD CONSTRAINT delegations_authority_check CHECK (authority IN ('gov-ops', 'fin-ops', 'dev-ops', 'custom'));
|
ALTER TABLE delegations ADD CONSTRAINT delegations_authority_check CHECK (authority IN ('gov-ops', 'fin-ops', 'dev-ops', 'custom'));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue