diff options
-rw-r--r-- | lib/gitlab/background_migration/delete_conflicting_redirect_routes_range.rb | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/gitlab/background_migration/delete_conflicting_redirect_routes_range.rb b/lib/gitlab/background_migration/delete_conflicting_redirect_routes_range.rb index a45fb6b6d0c..b1411be3016 100644 --- a/lib/gitlab/background_migration/delete_conflicting_redirect_routes_range.rb +++ b/lib/gitlab/background_migration/delete_conflicting_redirect_routes_range.rb @@ -28,25 +28,14 @@ module Gitlab <<~ROUTES_MATCH_REDIRECTS EXISTS ( SELECT 1 FROM routes - WHERE (#{route_paths_match_redirects}) + WHERE ( + LOWER(redirect_routes.path) = LOWER(routes.path) + OR LOWER(redirect_routes.path) LIKE LOWER(CONCAT(routes.path, '/%')) + ) AND routes.id BETWEEN #{start_id} AND #{end_id} ) ROUTES_MATCH_REDIRECTS end - - def route_paths_match_redirects - if Gitlab::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, '/%') - ROUTE_PATHS_MATCH_REDIRECTS - end - end end end end |