fix(db): backfill the users.locale column as a migration (#140)

`users.locale` has been on `schema.prisma` since the v1.3 locale-aware
reminder work but never landed in the migration history — the column
was applied via `prisma db push` to dev/prod and not committed as a
migration. The drift is invisible against any environment that was
ever pushed to, and only surfaces when a fresh database is built
strictly from `prisma/migrations/` (CI integration test containers,
brand-new self-host installs from a tagged image, etc.) — Postgres
then reports `column users.locale does not exist` the first time the
Prisma client touches the column.

The migration is `ADD COLUMN IF NOT EXISTS`, so it's a clean add on a
fresh database and a safe no-op against any environment that was
already pushed-to.
This commit is contained in:
Marc-André Bombeck authored and GitHub committed 2026-05-08 14:29:44 +02:00
1 parent 3221f86eea
commit 873f3eb8d0
1 file changed
+14
@@ -0,0 +1,14 @@
-- 0025_user_locale_drift_fix
-- The `users.locale` column has been on `prisma/schema.prisma` since the
-- locale-aware reminder work in v1.3 but never landed in the migration
-- history (it must have been applied via `prisma db push` to dev / prod
-- but not committed as a migration). The schema drift is invisible until
-- a fresh database is built from migrations alone — at which point the
-- Prisma client tries to read `users.locale` and Postgres reports
-- `column users.locale does not exist`.
--
-- This migration backfills the column with `IF NOT EXISTS` so it is a
-- safe no-op against any database that was kept in sync via `db push`,
-- and a clean add against any environment built strictly from this
-- migrations directory (CI test containers, fresh deploys, etc.).
ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "locale" TEXT;