| a22e4aec Andy McCall ↶ |
1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
CREATE TABLE authenticators ( |
| 6 |
token_id BIGINT PRIMARY KEY REFERENCES tokens(id) ON DELETE CASCADE, |
| 7 |
account_id BIGINT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, |
| 8 |
name TEXT NOT NULL, |
| 9 |
public_key TEXT NOT NULL, |
| 10 |
created_ms BIGINT NOT NULL, |
| 11 |
last_used_ms BIGINT NOT NULL DEFAULT 0 |
| 12 |
); |
| 13 |
CREATE INDEX authenticators_by_account ON authenticators (account_id); |
| 14 |
|
| 15 |
CREATE TABLE approvals ( |
| 16 |
id TEXT PRIMARY KEY, |
| 17 |
account_id BIGINT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, |
| 18 |
kind TEXT NOT NULL, |
| 19 |
what TEXT NOT NULL, |
| 20 |
number BIGINT NOT NULL, |
| 21 |
choices TEXT NOT NULL, |
| 22 |
session_id BIGINT, |
| 23 |
created_ms BIGINT NOT NULL, |
| 24 |
expires_ms BIGINT NOT NULL, |
| 25 |
state TEXT NOT NULL DEFAULT 'pending', |
| 26 |
decided_ms BIGINT NOT NULL DEFAULT 0, |
| 27 |
decided_by BIGINT |
| 28 |
); |
| 29 |
CREATE INDEX approvals_by_account ON approvals (account_id, state); |
| 30 |
|
| 31 |
ALTER TABLE sessions ADD COLUMN second_factor_ms BIGINT NOT NULL DEFAULT 0; |