返回 DeepSeek-Reasonix
migrate-access.sql
根目录 / workers / crash-report / migrate-access.sql
1 -- Unify dashboard auth onto id.reasonix.io: dashboard access is now a per-email
2 -- role, not a local password/session. Identity is resolved from the shared
3 -- account service; this table only records who may view the dashboard.
4 -- Apply: wrangler d1 execute reasonix-crash --remote --file=migrate-access.sql
5 CREATE TABLE IF NOT EXISTS access (
6 id INTEGER PRIMARY KEY AUTOINCREMENT,
7 email TEXT NOT NULL UNIQUE,
8 role TEXT NOT NULL DEFAULT 'pending',
9 created_at TEXT NOT NULL,
10 approved_at TEXT,
11 approved_by TEXT
12 );
13
14 -- Carry over every existing dashboard account's role by email, so current
15 -- admins/viewers keep their access when they next sign in via id.reasonix.io.
16 INSERT OR IGNORE INTO access (email, role, created_at, approved_at)
17 SELECT lower(email), role, created_at, approved_at FROM users;
18
18 lines SQL