Feature/stacked prs - #825
Conversation
|
Someone is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel. A member of the Team first needs to authorize it. |
jakharmonika364
left a comment
There was a problem hiding this comment.
Three spots, assuming the branch gets rebased onto clean main first (drop the carried-over mergeFreezeWindows commit):
1. Rebase (do this first, not a code edit)
git fetch origin main
git rebase origin/main feature/stacked-prs
This drops the duplicate feat: implement database schema merge freeze windows (#819) commit so the diff only shows the base_branch/head_branch change.
2. src/lib/db/schema.ts - pullRequests table, line ~446 (the (t) => ({...}) index block)
Add a repo-scoped index next to the existing ones:
(t) => ({
uniqRepoNumber: uniqueIndex('pull_requests_repo_number_unique').on(t.repoFullName, t.number),
repoStateIdx: index('pull_requests_repo_state_idx').on(
t.repoFullName,
t.state,
t.githubUpdatedAt,
),
authorIdx: index('pull_requests_author_idx').on(t.authorUserId, t.state),
repoHeadBranchIdx: index('pull_requests_repo_head_branch_idx').on(
t.repoFullName,
t.headBranch,
),
}),
3. New file supabase/migrations/0044_pull_requests_branch_tracking.sql (next number after 0043_activity_log_read_at.sql - coordinate with #824 so they don't collide on the same number):
alter table pull_requests
add column base_branch text,
add column head_branch text;
create index pull_requests_repo_head_branch_idx on pull_requests(repo_full_name, head_branch);
That's it - pull_requests already has RLS/policies from prior migrations, so no new policy needed here, just the column + index.
Closes #818
Description
This PR implements the core database schema additions required for the Stacked PRs / Dependent PR Chaining feature.
Changes Made
base_branchandhead_branchcolumns to thepullRequeststable insrc/lib/db/schema.ts.Next Steps
By tracking the base and head branches of all synchronized PRs, the backend webhook handlers can now automatically calculate parent-child relationships (e.g. if
PR Bhas a base branch that matchesPR A's head branch, it is a dependent PR).Future PRs will use this data layer to render the Mermaid.js / React Flow dependency graph on the frontend PR view and implement the backend merge-block logic.
Screenshots / UI Thoughts
Schema changes only. The visual graph implementation will follow in a subsequent PR.