Relax legacy ContractClock receipt constraint
This commit is contained in:
@@ -19,6 +19,8 @@ BEGIN
|
||||
) THEN
|
||||
EXECUTE 'UPDATE execution_receipts
|
||||
SET tool_name = COALESCE(tool_name, skill_name)';
|
||||
EXECUTE 'ALTER TABLE execution_receipts
|
||||
ALTER COLUMN skill_name DROP NOT NULL';
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
|
||||
18
db/migrations/003_relax_legacy_receipt_skill.sql
Normal file
18
db/migrations/003_relax_legacy_receipt_skill.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Migration 002 may already have run on a legacy database before its
|
||||
-- skill_name constraint reconciliation was added. Relax that obsolete column
|
||||
-- in a separately versioned migration so current installations are repaired.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = current_schema()
|
||||
AND table_name = 'execution_receipts'
|
||||
AND column_name = 'skill_name'
|
||||
AND is_nullable = 'NO'
|
||||
) THEN
|
||||
EXECUTE 'ALTER TABLE execution_receipts
|
||||
ALTER COLUMN skill_name DROP NOT NULL';
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
Reference in New Issue
Block a user