27 lines
653 B
SQL
27 lines
653 B
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
SELECT 'up SQL query';
|
|
|
|
CREATE TABLE sessions (
|
|
id bigserial primary key,
|
|
session_token varchar(200) not null unique,
|
|
csrf_token varchar(200) not null unique,
|
|
user_id bigserial references users(id),
|
|
created_at timestamp default current_timestamp,
|
|
expired_at timestamp not null
|
|
);
|
|
|
|
create index concurrently if not exists idx_sessions_session_token_csrf_token
|
|
on sessions (session_token, csrf_token);
|
|
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
SELECT 'down SQL query';
|
|
|
|
drop index concurrently idx_sessions_session_token_csrf_token;
|
|
drop table sessions;
|
|
|
|
-- +goose StatementEnd
|