All rules Rule BV043
note
hosted, paid — --remote

serial instead of an identity column

Note — this works and blocks nothing, but a performance regression is likely.

What it catches

serial is a legacy macro: the sequence it creates is only loosely attached, permissions and ownership drift from the column, and anyone can still insert arbitrary values. GENERATED ... AS IDENTITY is the standard replacement with tighter semantics.

Fires on

CREATE TABLE users (id bigserial PRIMARY KEY);

Do this instead

Use GENERATED ALWAYS AS IDENTITY (or BY DEFAULT if tooling must insert explicit ids): the sequence is owned by the column, permissions follow it, and accidental manual inserts are rejected instead of silently desynchronizing the sequence.

CREATE TABLE users (
  id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY
);
Catch this before it ships

This rule runs in the hosted service on Startup and above — add --remote with a team token, or use the GitHub Action: npx bolvrk check migration.sql