diff options
Diffstat (limited to 'db/migrate/20180717125853_remove_restricted_todos.rb')
-rw-r--r-- | db/migrate/20180717125853_remove_restricted_todos.rb | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/db/migrate/20180717125853_remove_restricted_todos.rb b/db/migrate/20180717125853_remove_restricted_todos.rb deleted file mode 100644 index 1d4bbf6571e..00000000000 --- a/db/migrate/20180717125853_remove_restricted_todos.rb +++ /dev/null @@ -1,31 +0,0 @@ -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. -# frozen_string_literal: true - -class RemoveRestrictedTodos < ActiveRecord::Migration[4.2] - DOWNTIME = false - disable_ddl_transaction! - - MIGRATION = 'RemoveRestrictedTodos'.freeze - BATCH_SIZE = 1000 - DELAY_INTERVAL = 5.minutes.to_i - - class Project < ActiveRecord::Base - include EachBatch - - self.table_name = 'projects' - end - - def up - Project.where('EXISTS (SELECT 1 FROM todos WHERE todos.project_id = projects.id)') - .each_batch(of: BATCH_SIZE) do |batch, index| - range = batch.pluck('MIN(id)', 'MAX(id)').first - - BackgroundMigrationWorker.perform_in(index * DELAY_INTERVAL, MIGRATION, range) - end - end - - def down - # nothing to do - end -end |