hackathon/sql/schema.sql

19 lines
487 B
SQL

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,
grade_level INTEGER,
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);