mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-10 03:16:07 +08:00
Added users sessions (#696)
Added login/logout pages and respective database methods for handling users sessions.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
PRAGMA auto_vacuum = INCREMENTAL;
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
-- DROP TABLE IF EXISTS users;
|
||||
DROP TABLE IF EXISTS users;
|
||||
DROP TABLE IF EXISTS sessions;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id text PRIMARY KEY,
|
||||
@@ -25,3 +27,12 @@ BEGIN
|
||||
WHERE
|
||||
id = old.id;
|
||||
END;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
id text PRIMARY KEY NOT NULL,
|
||||
user_id text REFERENCES users(id) ON DELETE CASCADE,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
accessed_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS session_users_idx ON sessions(user_id);
|
||||
|
||||
Reference in New Issue
Block a user