feat(fase-9): migration 015 — users.theme column for dark mode
Adds `theme text not null default 'system' check (theme in
('light','dark','system'))` to public.users. New users get 'system' so
the UI follows the OS preference until they opt in; existing rows
backfill via the default.
Includes pgTAP test 009 (8 assertions covering column existence/type,
default value, valid transitions, and the check constraint rejecting
unknown values). Wires the theme field into the hand-curated
database.ts type so PostgREST queries stay typed.
Also hardens `just db-types` to bail out (instead of truncating
database.ts) when the supabase CLI is missing — the recipe was silently
wiping the file on this dev machine.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
15
Justfile
15
Justfile
@@ -47,9 +47,20 @@ db-migrate:
|
||||
db-seed:
|
||||
docker exec -i colectivo-dev-db-1 psql -U postgres < supabase/seed.sql
|
||||
|
||||
# Regenerate TypeScript types from Supabase schema
|
||||
# Regenerate TypeScript types from Supabase schema.
|
||||
# Writes to a tempfile first so a missing/failing `supabase` CLI does not
|
||||
# truncate the existing hand-curated database.ts (which would silently
|
||||
# break every TS consumer in the monorepo).
|
||||
db-types:
|
||||
supabase gen types typescript --local > packages/types/src/database.ts
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if ! command -v supabase >/dev/null 2>&1; then
|
||||
echo "supabase CLI not installed — database.ts is hand-curated, edit it manually" >&2
|
||||
exit 1
|
||||
fi
|
||||
tmp=$(mktemp)
|
||||
supabase gen types typescript --local > "$tmp"
|
||||
mv "$tmp" packages/types/src/database.ts
|
||||
echo "Types written to packages/types/src/database.ts"
|
||||
|
||||
# Open Supabase Studio
|
||||
|
||||
Reference in New Issue
Block a user