1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-29 06:24:20 +00:00
royalnet/migrations/2024-08-14-091307_add_matchmaking_events/up.sql

35 lines
834 B
MySQL
Raw Normal View History

CREATE TYPE matchmaking_choice AS ENUM (
'yes',
'late',
'maybe',
'dontw',
'cant',
'wont'
);
CREATE TABLE matchmaking_events (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
text VARCHAR NOT NULL,
starts_at TIMESTAMP NOT NULL
);
CREATE TABLE matchmaking_replies (
matchmaking_id INTEGER REFERENCES matchmaking_events(id) NOT NULL,
user_id INTEGER REFERENCES users(id) NOT NULL,
choice matchmaking_choice NOT NULL,
late_mins INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY(matchmaking_id, user_id)
);
CREATE TABLE matchmaking_messages_telegram (
matchmaking_id INTEGER REFERENCES matchmaking_events(id) NOT NULL,
telegram_chat_id BIGINT NOT NULL,
telegram_message_id INTEGER NOT NULL,
PRIMARY KEY(matchmaking_id, telegram_chat_id, telegram_message_id)
)