1 PRAGMA foreign_keys=ON;
    2 
    3 -- A user within our system.
    4 CREATE TABLE user (
    5 	-- E-mail address.
    6 	email TEXT UNIQUE NOT NULL,
    7 	-- Hashed password.
    8 	hash TEXT NOT NULL,
    9 	id INTEGER PRIMARY KEY
   10 );
   11 
   12 -- A logged-in user.
   13 CREATE TABLE sess (
   14 	-- User identifier attached to session.
   15 	userid INTEGER NOT NULL,
   16 	-- Random token for authentication.
   17 	token INTEGER NOT NULL,
   18 	id INTEGER PRIMARY KEY,
   19 	FOREIGN KEY(userid) REFERENCES user(id)
   20 );
   21