mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
14 lines
649 B
SQL
14 lines
649 B
SQL
-- Password reset (migration 0005). Magic-link "forgot password" flow.
|
|
-- We store only a SHA-256 hash of the reset token, never the token itself, so a DB
|
|
-- leak does not yield usable reset links. The raw token lives only in the email link.
|
|
CREATE TABLE IF NOT EXISTS password_resets (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
user_id INTEGER NOT NULL,
|
|
token_hash TEXT NOT NULL,
|
|
expires_at TEXT NOT NULL,
|
|
used_at TEXT,
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_password_resets_token ON password_resets(token_hash);
|
|
CREATE INDEX IF NOT EXISTS idx_password_resets_user ON password_resets(user_id);
|