Skip to content

Remove project_repository record when removing a project repository

What does this MR do and why?

This change improves how the system handles repository cleanup when projects are deleted or removed. Previously, when removing a repository, the code only deleted the actual git repository files but left behind database records that track repository information.

The update ensures that both the physical repository files AND the associated database records (called "project_repository") are properly cleaned up together. This prevents orphaned database entries that could cause issues later.

This is essentially a housekeeping improvement that makes the deletion process more thorough and consistent, reducing the chance of leftover data causing problems down the road.

Database review information

One new query is introduced in app.models/project.rb in the method remove_repository by the statement project_repository&.destroy. The SQL is DELETE FROM "project_repositories" WHERE "project_repositories"."id" = 4 The query plan can be found here https://explain.depesz.com/s/xMPp#html

References

Geo: Remove `project_repository` record when re... (#578220)

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Aakriti Gupta

Merge request reports

Loading