v0.15.0 password recovery, phone layout, CLI pager, embed policy fixes
test / test (push) Canceled after 0s
test / e2e (push) Canceled after 0s

This commit is contained in:
lixen committed 2026-10-19 18:15:31 -04:00
1 parent a999177f0c
commit e1fa5242e3
48 files changed
+2101 -135

No files matched your search

+17 -2
View File
@@ -81,7 +81,7 @@ type MovePersistence struct {
// schemaVersion is the newest schema this binary understands. Migrations are
// applied in order inside one transaction; PostgreSQL DDL is transactional, so
// a failed upgrade leaves the previous version intact.
const schemaVersion = 3
const schemaVersion = 4
// migrations[v-1] upgrades the schema from version v-1 to v. Never edit a
// released migration; append a new one.
@@ -212,8 +212,23 @@ ALTER TABLE games ADD CONSTRAINT games_concession_check CHECK (
OR (concession_ply >= 0 AND concession_time_utc IS NOT NULL AND (
(concession_result IN ('white_wins', 'black_wins') AND concession_termination = 'resignation')
OR (concession_result = 'draw' AND concession_termination = 'agreement'))));
`,
// v4: password recovery. One pending reset per account; the token the
// email carries is never stored, only its SHA-256, and it expires after
// an hour. Consuming a token deletes the row.
`
CREATE TABLE password_resets (
user_id uuid PRIMARY KEY REFERENCES users (user_id) ON DELETE CASCADE,
token_hash bytea NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
expires_at timestamptz NOT NULL,
CONSTRAINT password_resets_token_hash_key UNIQUE (token_hash),
CONSTRAINT password_resets_token_hash_check CHECK (octet_length(token_hash) = 32)
);
CREATE INDEX password_resets_expires_at_idx ON password_resets (expires_at);
`,
}
// ownedTables lists every table created by migrations, children first.
var ownedTables = []string{"moves", "games", "sessions", "users", "schema_version"}
var ownedTables = []string{"moves", "games", "password_resets", "sessions", "users", "schema_version"}