mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-11 12:15:34 +08:00
Added users sessions (#696)
Added login/logout pages and respective database methods for handling users sessions.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
DROP TABLE IF EXISTS sessions;
|
||||
DROP TABLE IF EXISTS users;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
@@ -14,3 +15,10 @@ CREATE TABLE IF NOT EXISTS users (
|
||||
UNIQUE (email),
|
||||
UNIQUE (username)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
id text PRIMARY KEY NOT NULL,
|
||||
user_id text REFERENCES users(id) ON DELETE CASCADE,
|
||||
created_at timestamptz DEFAULT (now() at time zone 'utc'),
|
||||
accessed_at timestamptz DEFAULT (now() at time zone 'utc')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user