MP055CRITICALFree

drop-pk-replica-identity-break

What It Detects

Dropping a primary key breaks logical replication unless REPLICA IDENTITY is explicitly set.

Why It's Dangerous

The default replica identity IS the primary key. When you drop a PK without setting REPLICA IDENTITY FULL or USING INDEX, all subsequent UPDATE and DELETE operations fail on logical replication subscribers (Supabase, Neon, AWS RDS read replicas, Debezium CDC).

Bad Example

ALTER TABLE users DROP CONSTRAINT users_pkey;
-- Logical replication breaks silently

Good Example

ALTER TABLE users REPLICA IDENTITY FULL;
ALTER TABLE users DROP CONSTRAINT users_pkey;

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP055: false

Or change its severity:

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