diff --git a/src/GmRelay.Bot/Migrations/V011__add_calendar_subscriptions.sql b/src/GmRelay.Bot/Migrations/V011__add_calendar_subscriptions.sql new file mode 100644 index 0000000..dbfe1f8 --- /dev/null +++ b/src/GmRelay.Bot/Migrations/V011__add_calendar_subscriptions.sql @@ -0,0 +1,11 @@ +CREATE TABLE calendar_subscriptions ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + token TEXT UNIQUE NOT NULL, + user_telegram_id BIGINT NOT NULL, + group_id UUID REFERENCES game_groups(id) ON DELETE CASCADE, + filter_type SMALLINT NOT NULL DEFAULT 0, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + expires_at TIMESTAMPTZ +); + +CREATE INDEX ix_calendar_subscriptions_user_telegram_id ON calendar_subscriptions (user_telegram_id);