mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 12:04:20 +00:00
35 lines
834 B
MySQL
35 lines
834 B
MySQL
|
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)
|
||
|
)
|