Skip to content

Cleanup leftovers in packages_dependencies table

What does this MR do and why?

MR !20549 (merged) added two tables: packages_dependencies and packages_dependency_links. When a package is deleted, packages_dependency_links rows are properly deleted but rows in packages_dependencies are kept and they can become orphans. This MR aims to clean up those orphaned packages_dependencies records.

How to set up and validate locally

  1. In Rails console, create a bunch of orphaned packages_dependencies records: FactoryBot.create_list(:packages_dependency, 100)
  2. Enable the feature flag : Feature.enable(:packages_delete_orphaned_dependencies_worker)
  3. Run the cleanup sidekiq worker: Packages::Cleanup::DeleteOrphanedDependenciesWorker.perform_async, the orphaned records should be deleted.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Database analysis

  1. !113076 (comment 1297596269)
  2. !113076 (comment 1322050386)

Related to #38266 (closed)

Edited by David Fernandez

Merge request reports

Loading