add reading settings sync

This commit is contained in:
Krispire Admin
2026-05-31 07:07:36 +05:30
parent 430747536d
commit 05b61cef09
6 changed files with 116 additions and 0 deletions
@@ -0,0 +1 @@
ALTER TABLE users DROP COLUMN IF EXISTS reading_prefs;
@@ -0,0 +1,15 @@
-- 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;