2021-09-28 23:57:59 +07:00
|
|
|
CREATE TABLE users (
|
|
|
|
id TEXT PRIMARY KEY NOT NULL, -- supplied from google - not auto increment
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
email TEXT NOT NULL UNIQUE,
|
|
|
|
picture TEXT NOT NULL,
|
2021-09-30 10:32:18 +07:00
|
|
|
grade_level INTEGER,
|
|
|
|
admin BOOLEAN NOT NULL,
|
|
|
|
created_at DATETIME NOT NULL
|
2021-09-28 23:57:59 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE tokens (
|
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
|
|
token TEXT NOT NULL UNIQUE,
|
|
|
|
user_id TEXT NOT NULL REFERENCES users (id),
|
|
|
|
created_at DATETIME NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX user_tokens ON tokens(user_id);
|