MP026CRITICALFree

ban-drop-table

What It Detects

DROP TABLE permanently removes the table and all its data.

Why It's Dangerous

DROP TABLE is irreversible and acquires ACCESS EXCLUSIVE lock. All data, indexes, constraints, and triggers are permanently destroyed. Consider renaming the table first as a soft-delete.

Bad Example

DROP TABLE users;

Good Example

-- Soft-delete: rename first, drop later after verification
ALTER TABLE users RENAME TO users_deprecated;
-- After confirming no dependencies:
DROP TABLE users_deprecated;

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP026: false

Or change its severity:

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