aboutsummaryrefslogtreecommitdiff
path: root/captain/sql
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2022-04-26 17:10:33 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2022-04-26 17:10:33 -0400
commitff0095ff928dca78bf07148c4081191fd57f9c4d (patch)
tree9af74ca04fc2a4f0b5237c492c9e411458c8c010 /captain/sql
parent9d912cdd8f2fc637a5876ca21a7ce5906e34e889 (diff)
downloadlevitating-ff0095ff928dca78bf07148c4081191fd57f9c4d.tar.gz
levitating-ff0095ff928dca78bf07148c4081191fd57f9c4d.zip
Added routines for validating user passwords and creating new users. Added routines for looking up sessions.
Diffstat (limited to 'captain/sql')
-rw-r--r--captain/sql/create.sql5
1 files changed, 5 insertions, 0 deletions
diff --git a/captain/sql/create.sql b/captain/sql/create.sql
index 8e93e23..9e4d204 100644
--- a/captain/sql/create.sql
+++ b/captain/sql/create.sql
@@ -17,3 +17,8 @@ CREATE TABLE checkin(player INTEGER PRIMARY KEY, year INTEGER, month INTEGER, da
CREATE TABLE schedule(instruction INTEGER NOT NULL, player INTEGER NOT NULL, day INTEGER DEFAULT 0, hour INTEGER DEFAULT 0, FOREIGN KEY(instruction) REFERENCES instructions(id) ON DELETE CASCADE, FOREIGN KEY(player) REFERENCES players(id) ON DELETE CASCADE );
+CREATE TABLE users(id INTEGER PRIMARY KEY, username TEXT UNIQUE NOT NULL, email TEXT NOT NULL, password TEXT NOT NULL, level INTEGER DEFAULT 1);
+
+CREATE TABLE sessions(user INTEGER, session TEXT NOT NULL, expiration TEXT NOT NULL, FOREIGN KEY(user) REFERENCES users(id) ON DELETE CASCADE);
+
+CREATE VIEW session_auth AS SELECT sessions.session, users.username, users.level FROM sessions INNER JOIN users ON sessions.user = users.id;