Files
contract-clock-studio-v1/db/migrations/003_relax_legacy_receipt_skill.sql

19 lines
615 B
SQL

-- 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
$$;