CREATE TABLE IF NOT EXISTS project_activity (
    id BIGSERIAL PRIMARY KEY,
    project UUID NOT NULL,
    repo UUID,
    actor UUID NOT NULL,
    event_type VARCHAR(50) NOT NULL,
    event_id UUID,
    event_sub_id BIGINT,
    title VARCHAR(500) NOT NULL,
    content TEXT,
    metadata JSONB,
    is_private BOOLEAN NOT NULL DEFAULT false,
    created_at TIMESTAMPTZ NOT NULL
);

CREATE INDEX idx_project_activity_project ON project_activity (project);
CREATE INDEX idx_project_activity_created_at ON project_activity (created_at DESC);
CREATE INDEX idx_project_activity_event_type ON project_activity (event_type);
