Add independent verified email accounts and revocable sessions
waterfall-wiki CI and deployment / verify-and-deploy (pull_request) Failing after 11m56s

This commit is contained in:
2026-10-29 16:34:53 +08:00
parent 8d487fa457
commit 134bc2c9cc
15 changed files with 468 additions and 4 deletions
@@ -0,0 +1,22 @@
BEGIN;
CREATE TABLE account_users (
id uuid PRIMARY KEY,
email text NOT NULL UNIQUE,
password_hash text NOT NULL,
verified_at timestamptz,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE TABLE account_tokens (
digest text PRIMARY KEY,
user_id uuid NOT NULL REFERENCES account_users(id) ON DELETE CASCADE,
kind text NOT NULL CHECK (kind IN ('verify','session')),
expires_at timestamptz NOT NULL
);
CREATE INDEX account_tokens_expiry ON account_tokens(expires_at);
CREATE TABLE account_limits (
key text PRIMARY KEY,
attempts integer NOT NULL,
window_start timestamptz NOT NULL
);
INSERT INTO schema_migrations(version) VALUES ('014_email_accounts');
COMMIT;