CREATE TABLE IF NOT EXISTS project_member_invitations (
    id BIGSERIAL PRIMARY KEY,
    project UUID NOT NULL,
    "user" UUID NOT NULL,
    invited_by UUID NOT NULL,
    scope VARCHAR(255) NOT NULL,
    accepted BOOLEAN NOT NULL DEFAULT false,
    accepted_at TIMESTAMPTZ,
    rejected BOOLEAN NOT NULL DEFAULT false,
    rejected_at TIMESTAMPTZ,
    created_at TIMESTAMPTZ NOT NULL
);

CREATE INDEX idx_project_member_invitations_project_user ON project_member_invitations (project, "user");
