vegapokerbot/internal/db/migrations/1_init.up.sql

23 lines
555 B
MySQL
Raw Normal View History

2024-05-07 21:49:09 +03:00
CREATE TABLE "user" (
id BIGSERIAL PRIMARY KEY,
telegram_id BIGINT NOT NULL,
chat_id BIGINT NOT NULL,
language VARCHAR(8)
2024-05-07 21:49:09 +03:00
);
CREATE TABLE chat (
id BIGSERIAL PRIMARY KEY,
telegram_id BIGINT NOT NULL,
user_id BIGINT NOT NULL,
keyboard_type VARCHAR(6),
2024-05-07 21:49:09 +03:00
FOREIGN KEY (user_id) REFERENCES "user"(id) ON DELETE CASCADE
);
CREATE TABLE integration (
id BIGSERIAL PRIMARY KEY,
type VARCHAR(32) NOT NULL,
chat_id BIGINT NOT NULL,
params JSON,
FOREIGN KEY (chat_id) REFERENCES chat(id) ON DELETE CASCADE
);