MP045WARNINGFree

require-primary-key

What It Detects

Tables without a primary key break logical replication and many ORMs.

Why It's Dangerous

Tables without a primary key cannot be used with logical replication (pglogical, Citus, etc.), cause issues with ORMs, and make row-level operations inefficient.

Bad Example

CREATE TABLE events (
  name TEXT,
  data JSONB
);

Good Example

CREATE TABLE events (
  id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  name TEXT,
  data JSONB
);

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP045: false

Or change its severity:

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