summaryrefslogtreecommitdiff
path: root/db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb
blob: 021b52b9ed1ec3509964ffc7322fbe89a572a299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class DeleteConflictingRedirectRoutes < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  MIGRATION = 'DeleteConflictingRedirectRoutesRange'.freeze

  disable_ddl_transaction!

  class Route < ActiveRecord::Base
    include EachBatch

    self.table_name = 'routes'
  end

  def up
    say opening_message

    queue_background_migration_jobs_by_range(Route, MIGRATION)
  end

  def down
    # nothing
  end

  def opening_message
    <<~MSG
      Clean up redirect routes that conflict with regular routes.
         See initial bug fix:
         https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13357
    MSG
  end
end