aboutsummaryrefslogtreecommitdiff
path: root/captain/sql
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2022-04-28 12:51:26 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2022-04-28 12:51:26 -0400
commitb558fd94527e6a3f359c3ca766eeabaf0c7a8a57 (patch)
treedc8c84749e309f5fb8ff014839c76c8fc44095e5 /captain/sql
parente7aaa0256420e8d30dee54e603af60d54434c38e (diff)
downloadlevitating-b558fd94527e6a3f359c3ca766eeabaf0c7a8a57.tar.gz
levitating-b558fd94527e6a3f359c3ca766eeabaf0c7a8a57.zip
Sessions are now created and stored at login.
Diffstat (limited to 'captain/sql')
-rw-r--r--captain/sql/create.sql7
1 files changed, 5 insertions, 2 deletions
diff --git a/captain/sql/create.sql b/captain/sql/create.sql
index 7517e07..40cbc0c 100644
--- a/captain/sql/create.sql
+++ b/captain/sql/create.sql
@@ -15,10 +15,13 @@ CREATE TABLE group_instructions(group_id INTEGER, instruction INTEGER, player IN
CREATE TABLE checkin(player INTEGER PRIMARY KEY, year INTEGER, month INTEGER, day INTEGER, hour INTEGER, minute INTEGER, second INTEGER, os TEXT DEFAULT NULL, FOREIGN KEY(player) REFERENCES players(id) ON DELETE CASCADE);
-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 schedule(id INTEGER PRIMARY KEY, 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 scheduled_jobs(schedule INTEGER UNIQUE NOT NULL, job INTEGER UNIQUE NOT NULL, FOREIGN KEY(schedule) REFERENCES schedules(id) ON DELETE CASCADE, FOREIGN KEY(job) REFERENCES jobs(id));
CREATE TABLE users(id INTEGER PRIMARY KEY AUTOINCREMENT, 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 TABLE sessions(user INTEGER, session TEXT NOT NULL, accessed 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;
+