MP039WARNINGFree

prefer-identity-over-serial

What It Detects

SERIAL has quirks around ownership and permissions. Use GENERATED ALWAYS AS IDENTITY on PG 10+.

Why It's Dangerous

SERIAL creates an implicit sequence with complex ownership rules. GENERATED ALWAYS AS IDENTITY (PG 10+) is SQL-standard, has clearer semantics, and prevents accidental manual inserts.

Bad Example

CREATE TABLE users (id SERIAL PRIMARY KEY);

Good Example

CREATE TABLE users (id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY);

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP039: false

Or change its severity:

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