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);
