Skip to content

feat: enable maintainers processing for all git, github, and gitlab repos instead of github only (CM-773)#3594

Merged
mbani01 merged 2 commits into
mainfrom
feat/enable_maintainers_for_all_git_repos
Nov 12, 2025
Merged

feat: enable maintainers processing for all git, github, and gitlab repos instead of github only (CM-773)#3594
mbani01 merged 2 commits into
mainfrom
feat/enable_maintainers_for_all_git_repos

Conversation

@mbani01
Copy link
Copy Markdown
Contributor

@mbani01 mbani01 commented Nov 11, 2025

This pull request updates the foreign key relationship for the maintainersInternal table to reference the new git.repositories table instead of the old githubRepos table. The changes are implemented through two database migrations: one to remove the old foreign key and another to add the new one.

The end goal is to be able to process maintainers for all Git, GitHub, and GitLab repos instead of GitHubRepos only

Database schema migration:

  • Removes the foreign key constraint from maintainersInternal.repoId to githubRepos.id, eliminating the dependency on the githubRepos table.
  • Adds a new foreign key constraint from maintainersInternal.repoId to git.repositories.id, establishing the updated relationship and enabling cascading deletes.

Note

Updates maintainersInternal.repoId foreign key to reference git.repositories(id) with cascade delete, removing old githubRepos FK.

  • Database migration:
    • Drops existing FK maintainersInternal_repoId_fkey to githubRepos.id.
    • Adds FK from maintainersInternal.repoId to git.repositories(id) with ON DELETE CASCADE.

Written by Cursor Bugbot for commit 0ecd9ec. This will update automatically on new commits. Configure here.

@mbani01 mbani01 requested a review from themarolt November 11, 2025 16:43
@mbani01 mbani01 self-assigned this Nov 11, 2025
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Conventional Commits FTW!

@mbani01 mbani01 changed the title feat: db migrations to change repoId reference from githubRepos to git.repositories feat: db migrations to change repoid reference from githubRepos to git repositories (CM-773) Nov 11, 2025
@mbani01 mbani01 changed the title feat: db migrations to change repoid reference from githubRepos to git repositories (CM-773) feat: enable maintainers processing for all git, github, and gitlab repos instead of github only (CM-773) Nov 11, 2025
@@ -0,0 +1,7 @@
-- Migration to remove the foreign key constraint from maintainersInternal.repoId to githubRepos.id
-- This removes the dependency on githubRepos table
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not have both migrations in one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

ADD CONSTRAINT "maintainersInternal_repoId_fkey"
FOREIGN KEY ("repoId")
REFERENCES git.repositories(id)
ON DELETE CASCADE; No newline at end of file
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

ADD CONSTRAINT "maintainersInternal_repoId_fkey"
FOREIGN KEY ("repoId")
REFERENCES git.repositories(id)
ON DELETE CASCADE; No newline at end of file
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

@mbani01 mbani01 merged commit 0c09569 into main Nov 12, 2025
18 checks passed
@mbani01 mbani01 deleted the feat/enable_maintainers_for_all_git_repos branch November 12, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants