MP054CRITICALFree
alter-type-add-value-in-transaction
What It Detects
ALTER TYPE ADD VALUE in the same transaction as a statement referencing the new value will fail.
Why It's Dangerous
On PostgreSQL < 12, ALTER TYPE ADD VALUE cannot run inside a transaction at all. On PG 12+, it can run in a transaction but the new enum value is not visible to other statements in the same transaction — any INSERT or UPDATE referencing the new value will fail.
Bad Example
BEGIN;
ALTER TYPE status ADD VALUE 'archived';
INSERT INTO events (status) VALUES ('archived');
COMMIT;Good Example
-- Transaction 1:
ALTER TYPE status ADD VALUE 'archived';
-- Transaction 2 (after commit):
INSERT INTO events (status) VALUES ('archived');Configuration
Disable this rule:
# .migrationpilotrc.yml rules: MP054: false
Or change its severity:
# .migrationpilotrc.yml
rules:
MP054:
severity: warning