From acc70f7da1c21071a11bb07b86486c8e61799be8 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 12 Feb 2018 13:23:03 +0100 Subject: Move pipeline stages background migration in time --- .../20180105101928_schedule_build_stage_migration.rb | 20 -------------------- .../20180212101928_schedule_build_stage_migration.rb | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 db/post_migrate/20180105101928_schedule_build_stage_migration.rb create mode 100644 db/post_migrate/20180212101928_schedule_build_stage_migration.rb (limited to 'db/post_migrate') diff --git a/db/post_migrate/20180105101928_schedule_build_stage_migration.rb b/db/post_migrate/20180105101928_schedule_build_stage_migration.rb deleted file mode 100644 index b33127140bb..00000000000 --- a/db/post_migrate/20180105101928_schedule_build_stage_migration.rb +++ /dev/null @@ -1,20 +0,0 @@ -class ScheduleBuildStageMigration < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - MIGRATION = 'MigrateBuildStage'.freeze - BATCH = 1000 - - class Build < ActiveRecord::Base - include EachBatch - self.table_name = 'ci_builds' - end - - def change - Build.where('stage_id IS NULL').each_batch(of: BATCH) do |builds, index| - builds.pluck(:id).map { |id| [MIGRATION, [id]] }.tap do |migrations| - BackgroundMigrationWorker.bulk_perform_in(index.minutes, migrations) - end - end - end -end diff --git a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb new file mode 100644 index 00000000000..b33127140bb --- /dev/null +++ b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb @@ -0,0 +1,20 @@ +class ScheduleBuildStageMigration < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'MigrateBuildStage'.freeze + BATCH = 1000 + + class Build < ActiveRecord::Base + include EachBatch + self.table_name = 'ci_builds' + end + + def change + Build.where('stage_id IS NULL').each_batch(of: BATCH) do |builds, index| + builds.pluck(:id).map { |id| [MIGRATION, [id]] }.tap do |migrations| + BackgroundMigrationWorker.bulk_perform_in(index.minutes, migrations) + end + end + end +end -- cgit v1.2.1