mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
`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.
15 lines
846 B
SQL
15 lines
846 B
SQL
-- 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;
|