mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
v1.4.25 W7 phase 1 — adds AppSettings.defaultUserTimezone for the per-user-timezone feature (Option B from .planning/feature-user-timezone.md §4). User.timezone already exists in the schema as a NOT NULL column with 'Europe/Berlin' default — it is the canonical per-user display zone and needs no change. The only new piece is the server-wide default for new accounts that don't carry a browser-detected zone in the registration payload. Nullable so the resolver can fall back to 'Europe/Berlin' on every existing instance without an admin touching anything. Forward-only ALTER TABLE ADD COLUMN, no NOT NULL, no rename, no drop.
24 lines
1.0 KiB
SQL
24 lines
1.0 KiB
SQL
-- v1.4.25 W7 — per-user timezone feature (Option B from
|
|
-- `.planning/feature-user-timezone.md`).
|
|
--
|
|
-- HealthLog already ships a `users.timezone` column (default
|
|
-- 'Europe/Berlin', NOT NULL) from the original schema, so the
|
|
-- per-user side of this feature is non-additive at the storage
|
|
-- layer: the existing column is the canonical "display timezone"
|
|
-- that the resolver in `src/lib/tz/resolver.ts` reads. No change is
|
|
-- required on `users`.
|
|
--
|
|
-- The admin-managed default for *new* accounts is the only new
|
|
-- column. It lives on the singleton `app_settings` row and is
|
|
-- nullable so the resolver can fall back to "Europe/Berlin" when an
|
|
-- operator never touches the setting. Validated against
|
|
-- `Intl.supportedValuesOf('timeZone')` upstream — the column is just
|
|
-- a varchar(64) bag.
|
|
--
|
|
-- Forward-only / additive: ALTER TABLE ADD COLUMN with a nullable
|
|
-- type and no default. Existing rows are untouched. Rollback would
|
|
-- be a manual DROP COLUMN.
|
|
|
|
ALTER TABLE "app_settings"
|
|
ADD COLUMN IF NOT EXISTS "default_user_timezone" VARCHAR(64);
|