diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-09-18 08:24:52 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-09-18 08:24:52 +0000 |
commit | 36ad91d75a91bacb9b1b1c9997e734166cf4e201 (patch) | |
tree | 03e52e684612d3aa6f83363372940e3ea769b2ed /db/post_migrate | |
parent | b7cd5897098ec99b5eca7a3ebcc1c70d7501cd23 (diff) | |
parent | 7b7fb754118c7e86f94c4e5efaea632929d293da (diff) | |
download | gitlab-ce-36ad91d75a91bacb9b1b1c9997e734166cf4e201.tar.gz |
Merge branch 'mk-delete-conflicting-redirects-mysql' into 'master'
Clean up redirect routes that conflict with regular routes
Closes #36229
See merge request gitlab-org/gitlab-ce!13783
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb b/db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb new file mode 100644 index 00000000000..3e84b295be4 --- /dev/null +++ b/db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb @@ -0,0 +1,37 @@ +# 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 + BATCH_SIZE = 200 # At 200, I expect under 20s per batch, which is under our query timeout of 60s. + DELAY_INTERVAL = 12.seconds + + 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_at_intervals(Route, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + 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 |