diff options
author | Toby Vincent <tobyv@tobyvin.dev> | 2024-04-08 16:31:44 -0500 |
---|---|---|
committer | Toby Vincent <tobyv@tobyvin.dev> | 2024-04-11 23:49:41 -0500 |
commit | d9ed52fc239e3547eb99fe03bd296ab2808d2ebc (patch) | |
tree | 2fdc8a0e33bdf0902f608daa8e41d61df80ea9b2 /migrations | |
parent | 9a6c04d52edb10431f9f5ca2dbc83c410cb5daee (diff) |
wip: impl jwt handling
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/20240321225523_init.down.sql | 2 | ||||
-rw-r--r-- | migrations/20240321225523_init.up.sql | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/migrations/20240321225523_init.down.sql b/migrations/20240321225523_init.down.sql index ec52e0b..1726abe 100644 --- a/migrations/20240321225523_init.down.sql +++ b/migrations/20240321225523_init.down.sql @@ -1 +1 @@ -DROP TABLE IF EXISTS "users"; +DROP TABLE IF EXISTS sessions, users; diff --git a/migrations/20240321225523_init.up.sql b/migrations/20240321225523_init.up.sql index 7ae6aab..4ea79fe 100644 --- a/migrations/20240321225523_init.up.sql +++ b/migrations/20240321225523_init.up.sql @@ -5,10 +5,13 @@ CREATE TABLE users ( name VARCHAR(100) NOT NULL, email VARCHAR(255) NOT NULL UNIQUE, password_hash VARCHAR(100) NOT NULL, - created_at TIMESTAMP - WITH - TIME ZONE DEFAULT NOW(), - updated_at TIMESTAMP - WITH - TIME ZONE DEFAULT NOW() + session_epoch TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() +); + + +CREATE TABLE sessions ( + jti UUID NOT NULL PRIMARY KEY DEFAULT (uuid_generate_v4()), + uuid UUID NOT NULL REFERENCES users ON DELETE CASCADE ); |