hackathon/sql/schema.sql

20 lines
515 B
MySQL

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,
teacher BOOLEAN NOT NULL,
2021-09-30 10:32:18 +07:00
admin BOOLEAN NOT NULL,
created_at DATETIME NOT NULL
);
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);