17 lines
530 B
SQL
17 lines
530 B
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
create table sessions (
|
|
id text primary key, -- jti (random uuid)
|
|
user_id text not null references users (id) on delete cascade,
|
|
created_at timestamp with time zone default now(),
|
|
expires_at timestamp with time zone not null,
|
|
revoked boolean not null default false
|
|
);
|
|
|
|
create index sessions_user_id_idx on sessions (user_id);
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
drop table if exists sessions;
|
|
-- +goose StatementEnd
|