MP007CRITICALFree
no-column-type-change
What It Detects
ALTER COLUMN TYPE rewrites the entire table under ACCESS EXCLUSIVE lock.
Why It's Dangerous
Changing a column type requires rewriting every row in the table while holding an ACCESS EXCLUSIVE lock. Use the expand-contract pattern: add a new column, backfill, swap.
Bad Example
ALTER TABLE users ALTER COLUMN age TYPE BIGINT;
Good Example
-- Expand-contract pattern: ALTER TABLE users ADD COLUMN age_new BIGINT; UPDATE users SET age_new = age; -- Deploy code to read from age_new ALTER TABLE users DROP COLUMN age; ALTER TABLE users RENAME COLUMN age_new TO age;
Configuration
Disable this rule:
# .migrationpilotrc.yml rules: MP007: false
Or change its severity:
# .migrationpilotrc.yml
rules:
MP007:
severity: warning