CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0034_pr_review_requests.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 3247f79 | 1 | -- Block J11 — PR review requests (auto-assign from CODEOWNERS + manual). |
| 2 | -- | |
| 3 | -- Each row represents one reviewer who has been asked to review a PR. Rows | |
| 4 | -- are idempotent per (pr, reviewer) and track who requested it, the source | |
| 5 | -- (codeowners auto-assign, manual, or AI suggestion), and the resolution | |
| 6 | -- state once the reviewer submits a review or is dismissed. | |
| 7 | ||
| 8 | CREATE TABLE IF NOT EXISTS "pr_review_requests" ( | |
| 9 | "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 10 | "pull_request_id" uuid NOT NULL REFERENCES "pull_requests"("id") ON DELETE CASCADE, | |
| 11 | "reviewer_id" uuid NOT NULL REFERENCES "users"("id") ON DELETE CASCADE, | |
| 12 | "requested_by" uuid REFERENCES "users"("id") ON DELETE SET NULL, | |
| 13 | "source" text NOT NULL DEFAULT 'manual', -- 'codeowners' | 'manual' | 'ai' | |
| 14 | "state" text NOT NULL DEFAULT 'pending', -- 'pending' | 'approved' | 'changes_requested' | 'dismissed' | |
| 15 | "requested_at" timestamp NOT NULL DEFAULT now(), | |
| 16 | "resolved_at" timestamp | |
| 17 | ); | |
| 18 | ||
| 19 | CREATE UNIQUE INDEX IF NOT EXISTS "pr_review_requests_pr_reviewer_unique" | |
| 20 | ON "pr_review_requests" ("pull_request_id", "reviewer_id"); | |
| 21 | ||
| 22 | CREATE INDEX IF NOT EXISTS "pr_review_requests_reviewer_state_idx" | |
| 23 | ON "pr_review_requests" ("reviewer_id", "state"); |