MP058WARNINGFree

multi-alter-table-same-table

What It Detects

Multiple separate ALTER TABLE statements on the same table acquire the lock multiple times unnecessarily.

Why It's Dangerous

Each ALTER TABLE acquires ACCESS EXCLUSIVE lock independently. Multiple separate statements mean multiple lock/unlock cycles. Combining into a single ALTER TABLE reduces the blocking window from N lock cycles to one.

Bad Example

ALTER TABLE users ADD COLUMN bio text;
ALTER TABLE users ADD COLUMN avatar text;
-- 2 separate lock acquisitions

Good Example

ALTER TABLE users
  ADD COLUMN bio text,
  ADD COLUMN avatar text;
-- 1 lock acquisition

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP058: false

Or change its severity:

# .migrationpilotrc.yml
rules:
  MP058:
    severity: warning