MP041WARNINGAuto-fixableFree

ban-char-field

What It Detects

CHAR(n) pads with spaces, wastes storage, and causes comparison bugs.

Why It's Dangerous

CHAR(n) right-pads values with spaces to the declared length, wasting storage and causing subtle comparison bugs. Use TEXT or VARCHAR instead.

Bad Example

ALTER TABLE users ADD COLUMN country_code CHAR(2);

Good Example

ALTER TABLE users ADD COLUMN country_code TEXT;

Auto-fix

Run migrationpilot analyze file.sql --fix to automatically fix this violation.

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP041: false

Or change its severity:

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