Files
gitlab-foss/lib/gitlab/background_migration/delete_orphaned_routes.rb
2025-04-04 18:07:57 +00:00

20 lines
483 B
Ruby

# frozen_string_literal: true
module Gitlab
module BackgroundMigration
class DeleteOrphanedRoutes < BatchedMigrationJob
operation_name :delete_orphaned_routes
feature_category :groups_and_projects
def perform
each_sub_batch do |sub_batch|
sub_batch
.joins('LEFT JOIN namespaces ON namespaces.id = routes.namespace_id')
.where(namespaces: { id: nil })
.delete_all
end
end
end
end
end