-- Migration 028: add Euskera (Basque, ISO 639-1 `eu`) to the supported
-- `public.language_code` ENUM (Fase 20).
--
-- The plan (`plan/fase-20-euskera-locale.md` §20.1) was written against the
-- assumption that `public.users.language` is gated by a CHECK constraint.
-- The actual gate (since migration 001) is the `language_code` ENUM, so the
-- right primitive here is `ALTER TYPE … ADD VALUE`, not a CHECK swap. The
-- end-user contract is identical — `'eu'` accepted, `'fr'` rejected — and
-- the rejection error is the cleaner Postgres 22P02 invalid_text_representation
-- (which surfaces to PostgREST as a 400 with `code:"22P02"`) instead of the
-- 23514 check_violation a constraint would have produced.
--
-- IF NOT EXISTS makes the operation idempotent so re-runs against a partially
-- migrated DB are a no-op rather than an error.
--
-- ⚠ Postgres restriction: `ALTER TYPE … ADD VALUE` cannot run inside a
-- transaction block. The migration runner applies each .sql file
-- atomically per-file, so the statement must stand alone. Do NOT wrap it
-- in BEGIN/COMMIT.

ALTER TYPE public.language_code ADD VALUE IF NOT EXISTS 'eu';
