MP080WARNINGFree

ban-data-in-migration

What It Detects

Data manipulation (INSERT/UPDATE/DELETE) in a DDL migration file. Separate schema and data changes.

Why It's Dangerous

Mixing DDL and DML in the same migration makes rollback harder, increases lock duration, and violates separation of concerns. Data migrations should be in separate files with explicit rollback strategies.

Bad Example

CREATE TABLE settings (key TEXT, value TEXT);
INSERT INTO settings VALUES ('version', '1.0');

Good Example

-- migrations/003_schema.sql (DDL only)
CREATE TABLE settings (key TEXT, value TEXT);

-- migrations/004_seed.sql (DML only)
INSERT INTO settings VALUES ('version', '1.0');

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP080: false

Or change its severity:

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