mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-22 11:04:21 +00:00
34 lines
834 B
SQL
34 lines
834 B
SQL
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)
|
|
)
|