Development
This commit is contained in:
parent
edeb05acf7
commit
a886a56982
4 changed files with 142 additions and 108 deletions
|
|
@ -42,26 +42,31 @@ def init_accounts_db():
|
|||
con.executescript('''
|
||||
CREATE TABLE IF NOT EXISTS accounts (
|
||||
account_id TEXT PRIMARY KEY,
|
||||
email TEXT UNIQUE NOT NULL,
|
||||
access_level INTEGER NOT NULL DEFAULT 1,
|
||||
hashed_password TEXT NOT NULL DEFAULT '',
|
||||
created_ts INTEGER NOT NULL DEFAULT 0,
|
||||
created_by TEXT NOT NULL DEFAULT ''
|
||||
email TEXT NOT NULL UNIQUE,
|
||||
access_level INTEGER NOT NULL,
|
||||
hashed_password TEXT,
|
||||
created_ts INTEGER NOT NULL,
|
||||
created_by TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS clients (
|
||||
cookie_unique_token TEXT PRIMARY KEY,
|
||||
email TEXT UNIQUE,
|
||||
hashed_password TEXT,
|
||||
tz_offset_seconds INTEGER,
|
||||
verification_code TEXT,
|
||||
code_sent_ts INTEGER,
|
||||
flashes_json TEXT
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
session_id TEXT PRIMARY KEY,
|
||||
account_id TEXT NOT NULL,
|
||||
tz_offset_seconds INTEGER NOT NULL DEFAULT 0,
|
||||
apply_changes_immediately INTEGER NOT NULL DEFAULT 0,
|
||||
session_started_ts INTEGER NOT NULL,
|
||||
last_seen_ts INTEGER NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS pending_verifications (
|
||||
email TEXT PRIMARY KEY,
|
||||
hashed_password TEXT NOT NULL,
|
||||
tz_offset_seconds INTEGER NOT NULL DEFAULT 0,
|
||||
code TEXT NOT NULL,
|
||||
expires_ts INTEGER NOT NULL
|
||||
session_id TEXT PRIMARY KEY,
|
||||
account_id TEXT NOT NULL,
|
||||
tz_offset_seconds INTEGER NOT NULL,
|
||||
preferences_json TEXT NOT NULL,
|
||||
flashes_json TEXT,
|
||||
session_started_ts INTEGER NOT NULL,
|
||||
last_seen_ts INTEGER NOT NULL,
|
||||
FOREIGN KEY (session_id) REFERENCES clients(cookie_unique_token),
|
||||
FOREIGN KEY (account_id) REFERENCES accounts(account_id)
|
||||
);
|
||||
''')
|
||||
con.commit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue