teldrive/pkg/database/migrations/20231102165658_tables.sql
2023-12-03 01:17:23 +05:30

20 lines
505 B
SQL

-- +goose Up
-- +goose StatementBegin
ALTER TABLE teldrive.users DROP COLUMN IF EXISTS tg_session;
CREATE TABLE teldrive.sessions (
session text NOT NULL,
user_id bigint NOT NULL,
hash text NOT NULL,
created_at timestamp null default timezone('utc'::text,now()),
PRIMARY KEY(session, hash),
FOREIGN KEY (user_id) REFERENCES teldrive.users(user_id)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS teldrive.sessions;
-- +goose StatementEnd