Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Migration to remove the foreign key constraint from maintainersInternal.repoId to githubRepos.id
-- This removes the dependency on githubRepos table and creates the new reference to git.repositories table

ALTER TABLE "maintainersInternal"
DROP CONSTRAINT IF EXISTS "maintainersInternal_repoId_fkey";

ALTER TABLE "maintainersInternal"
ADD CONSTRAINT "maintainersInternal_repoId_fkey"
FOREIGN KEY ("repoId")
REFERENCES git.repositories(id)
ON DELETE CASCADE;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Foreign Key Migration Requires Data Synchronization

The migration adds a foreign key constraint referencing git.repositories(id) without ensuring all repoId values in maintainersInternal exist in git.repositories. If any maintainer records reference repos that haven't been synced from githubRepos to git.repositories yet, the constraint addition will fail with a foreign key violation. The migration needs a preceding data migration to populate git.repositories with all repos currently referenced by maintainersInternal before changing the constraint.

Fix in Cursor Fix in Web

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Materialized View Breaks Maintainer Processing

The migration changes maintainersInternal.repoId to reference git.repositories but doesn't update the mv_maintainer_roles materialized view, which still joins with githubRepos on repoId. This breaks the PR's stated goal of processing maintainers for all Git, GitHub, and GitLab repos, as the view will only show repos that exist in githubRepos. The view needs to be recreated to join with git.repositories instead.

Fix in Cursor Fix in Web

Loading