CREATE TABLE user_invites (
    id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    activity_id BIGINT NOT NULL,
    inviter_user_id BIGINT NOT NULL,
    invitee_user_id BIGINT NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
    CONSTRAINT fk_user_invites_activity FOREIGN KEY (activity_id) REFERENCES activities(id),
    CONSTRAINT uq_activity_invitee UNIQUE (activity_id, invitee_user_id)
);

CREATE INDEX idx_user_invites_activity ON user_invites(activity_id);
CREATE INDEX idx_user_invites_inviter ON user_invites(inviter_user_id);

