feat: implement argon2 and changed session data type to timestamptz

This commit is contained in:
Sérgio Salgado 2021-04-27 00:01:31 +01:00 committed by Josh Harvey
parent 86a245f6ba
commit 15769cd1bf
6 changed files with 185 additions and 10 deletions

View file

@ -5,7 +5,7 @@ exports.up = function (next) {
`CREATE TYPE role AS ENUM('user', 'superuser')`,
`CREATE TABLE users (
id UUID PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
username TEXT NOT NULL UNIQUE,
password VARCHAR(100),
role role NOT NULL DEFAULT 'user',
enabled BOOLEAN DEFAULT true,
@ -18,7 +18,7 @@ exports.up = function (next) {
`CREATE TABLE "user_sessions" (
"sid" VARCHAR NOT NULL COLLATE "default",
"sess" JSON NOT NULL,
"expire" TIMESTAMP(6) NOT NULL )
"expire" TIMESTAMPTZ NOT NULL )
WITH (OIDS=FALSE)`,
`ALTER TABLE "user_sessions" ADD CONSTRAINT "session_pkey" PRIMARY KEY ("sid") NOT DEFERRABLE INITIALLY IMMEDIATE`,
`CREATE INDEX "IDX_session_expire" ON "user_sessions" ("expire")`,