Files
spsays-bff/migrations/0009_add_user_reading_prefs.up.sql

16 lines
738 B
SQL

-- Adds per-user reading preferences (theme palette, font family, font
-- size, justification toggle) so the prefs roam across devices once the
-- user signs in.
--
-- Stored as JSONB rather than a column-per-field — the shape is owned
-- by the frontend (components/reading-settings.tsx), changes
-- occasionally (new palettes added every now and then), and we never
-- query individual keys server-side. JSONB keeps the schema stable as
-- the shape evolves.
--
-- Default `'{}'::jsonb` so existing rows are not nulled and the
-- frontend can treat the server response as "merge into local defaults"
-- without an additional null check.
ALTER TABLE users
ADD COLUMN IF NOT EXISTS reading_prefs JSONB NOT NULL DEFAULT '{}'::jsonb;