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

money type bound to server locale

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

What it catches

The money type's meaning depends on the server's lc_monetary locale: no currency is stored, fractional precision is fixed, and dumping/restoring across locales reinterprets the values. numeric plus an explicit currency column is the boring, correct answer.

Fires on

CREATE TABLE orders (total money);

Do this instead

Store amounts as numeric (or integer minor units) with an explicit currency column. Exact arithmetic, no locale dependence, dumps and restores mean the same thing everywhere.

CREATE TABLE orders (
  id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  total numeric(12,2) NOT NULL,
  currency text NOT NULL DEFAULT 'EUR'
);
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