Phase 10, part 2: the first owner, from a one-time setup link

A new server prints a link to create its owner (supermarket setup-link
makes another); until it's used, every page says the setup isn't
finished. One-time links (schema 33) are kept as hashes and used up in
one statement; resets and invitations will use them too. The server
edition opens Postgres.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 08:53:14 -07:00
co-authored by Claude Opus 5.5
parent 96404a3580
commit 72455438c9
16 changed files with 553 additions and 10 deletions
+14
View File
@@ -90,6 +90,20 @@ CREATE TABLE sessions (
user_agent TEXT NOT NULL DEFAULT ''
);
CREATE INDEX sessions_user ON sessions(user_id);
`,
},
// 33
{
Note: "one-time links: setting up the first owner, password resets, invitations",
SQLite: `
CREATE TABLE links (
id TEXT PRIMARY KEY, -- the SHA-256 of the link's random token
purpose TEXT NOT NULL, -- setup, reset or invite
user_id INTEGER NOT NULL DEFAULT 0, -- whose it is; 0 for setup
created_at TEXT NOT NULL,
expires_at TEXT NOT NULL
);
CREATE INDEX links_user ON links(user_id, purpose);
`,
},
}