initial commit
Some checks failed
ci / go (push) Has been cancelled
ci / admin-ui (push) Has been cancelled
ci / runtime-sdk (push) Has been cancelled
ci / helm (push) Has been cancelled
ci / openapi (push) Has been cancelled
ci / container (push) Has been cancelled
ci / release-config (push) Has been cancelled
ci / shared styling (push) Has been cancelled
ci / security (push) Has been cancelled
ci / all green (push) Has been cancelled
Some checks failed
ci / go (push) Has been cancelled
ci / admin-ui (push) Has been cancelled
ci / runtime-sdk (push) Has been cancelled
ci / helm (push) Has been cancelled
ci / openapi (push) Has been cancelled
ci / container (push) Has been cancelled
ci / release-config (push) Has been cancelled
ci / shared styling (push) Has been cancelled
ci / security (push) Has been cancelled
ci / all green (push) Has been cancelled
This commit is contained in:
commit
951dd8d26b
175 changed files with 50041 additions and 0 deletions
26
internal/store/migrations/0002_user_preferences.sql
Normal file
26
internal/store/migrations/0002_user_preferences.sql
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
-- Per-user interface preferences.
|
||||
--
|
||||
-- These live in their own table rather than as columns on users, because users is
|
||||
-- a projection of the identity provider's claims: UpsertUser rewrites it on every
|
||||
-- login. A row appears the first time somebody saves a preference and is keyed by
|
||||
-- the same subject, so the choice survives re-login and follows the account to
|
||||
-- another browser.
|
||||
--
|
||||
-- An empty selected_theme means the person has not chosen a theme, which the UI
|
||||
-- renders as its own default rather than as a stored value.
|
||||
--
|
||||
-- There is deliberately no foreign key to users. That table is a projection of the
|
||||
-- identity provider's claims and can be rebuilt from a backup, so a cascade from it
|
||||
-- would silently discard people's choices, and requiring the row to exist would make
|
||||
-- saving a preference depend on projection state that has nothing to do with the
|
||||
-- preference. A row whose subject never logs in again is inert and costs nothing.
|
||||
CREATE TABLE IF NOT EXISTS user_preferences (
|
||||
subject TEXT NOT NULL PRIMARY KEY,
|
||||
selected_theme TEXT NOT NULL DEFAULT '',
|
||||
selected_appearance TEXT NOT NULL DEFAULT '',
|
||||
updated_at TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- Lets an operator answer "who is using this theme?" without scanning every row.
|
||||
CREATE INDEX IF NOT EXISTS idx_user_preferences_theme
|
||||
ON user_preferences (selected_theme);
|
||||
Loading…
Add table
Add a link
Reference in a new issue