store: migration 0017 — users.email, disabled_at, must_change_password
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
-- 0017_users_extensions.sql
|
||||||
|
--
|
||||||
|
-- Add the columns the user-management UI needs:
|
||||||
|
-- email — optional, free-form text; format-checked
|
||||||
|
-- in Go on insert/update via net/mail.ParseAddress
|
||||||
|
-- disabled_at — soft-delete tombstone. NULL = enabled
|
||||||
|
-- must_change_password — flag set by admin-create + setup-token flow;
|
||||||
|
-- cleared by /setup or /settings/account
|
||||||
|
--
|
||||||
|
-- Plus a case-insensitive unique index so 'Alice' and 'alice' can't
|
||||||
|
-- both exist (lowercase normalisation is applied in the Go layer
|
||||||
|
-- on every CreateUser; this index defends the invariant).
|
||||||
|
--
|
||||||
|
-- Column-level ALTERs (CLAUDE.md prefers these over rebuilds; safe
|
||||||
|
-- under foreign_keys=ON).
|
||||||
|
|
||||||
|
ALTER TABLE users ADD COLUMN email TEXT;
|
||||||
|
ALTER TABLE users ADD COLUMN disabled_at TEXT;
|
||||||
|
ALTER TABLE users ADD COLUMN must_change_password INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX users_username_lower ON users(LOWER(username));
|
||||||
Reference in New Issue
Block a user