2024-05-07 21:49:09 +03:00
|
|
|
CREATE TABLE "user" (
|
|
|
|
id BIGSERIAL PRIMARY KEY,
|
2024-05-09 20:48:59 +03:00
|
|
|
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,
|
2024-05-09 20:48:59 +03:00
|
|
|
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
|
|
|
|
);
|