note
hosted, paid — --remote
char(n) with its padding semantics
Note — this works and blocks nothing, but a performance regression is likely.
What it catches
char(n) space-pads every value to n and strips the padding in surprising places — comparisons and lengths behave differently from every other string type, with no storage or speed benefit over text in Postgres.
Fires on
CREATE TABLE users (country_code char(2));Do this instead
Use text (with a CHECK constraint when the length is a real business rule) or varchar. In Postgres char(n) has no storage or performance advantage — only the padding surprises.
CREATE TABLE users (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
country_code text NOT NULL CHECK (char_length(country_code) = 2)
);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