Rails.logger.info("Gitlab::BackgroundMigration::DeleteConflictingRedirectRoutes [#{start_id}, #{end_id}] - Deleted #{num_rows} redirect routes that were conflicting with routes.")
end
defmigrate?
Route.table_exists?&&RedirectRoute.table_exists?
end
defroutes_match_redirects_clause(start_id,end_id)
<<~ROUTES_MATCH_REDIRECTS
EXISTS (
SELECT 1 FROM routes
WHERE (#{route_paths_match_redirects})
AND routes.id BETWEEN #{start_id} AND #{end_id}
)
ROUTES_MATCH_REDIRECTS
end
defroute_paths_match_redirects
ifGitlab::Database.postgresql?
<<~ROUTE_PATHS_MATCH_REDIRECTS
LOWER(redirect_routes.path) = LOWER(routes.path)
OR LOWER(redirect_routes.path) LIKE LOWER(CONCAT(routes.path, '/%'))
ROUTE_PATHS_MATCH_REDIRECTS
else
<<~ROUTE_PATHS_MATCH_REDIRECTS
redirect_routes.path = routes.path
OR redirect_routes.path LIKE CONCAT(routes.path, '/%')