Commit 73c7b968 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Remove migration dependency from stage_id migration

parent 2930c0e3
require Rails.root.join('db', 'post_migrate', '20170628080858_migrate_stage_id_reference_in_background')
class CleanStageIdReferenceMigration < ActiveRecord::Migration class CleanStageIdReferenceMigration < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
...@@ -11,8 +9,7 @@ class CleanStageIdReferenceMigration < ActiveRecord::Migration ...@@ -11,8 +9,7 @@ class CleanStageIdReferenceMigration < ActiveRecord::Migration
# `MigrateStageIdReferenceInBackground` background migration cleanup. # `MigrateStageIdReferenceInBackground` background migration cleanup.
# #
def up def up
Gitlab::BackgroundMigration Gitlab::BackgroundMigration.steal('MigrateBuildStageIdReference')
.steal(MigrateStageIdReferenceInBackground::MIGRATION)
end end
def down def down
......
require 'spec_helper' require 'spec_helper'
require Rails.root.join('db', 'migrate', '20170710083355_clean_stage_id_reference_migration.rb') require Rails.root.join('db', 'migrate', '20170710083355_clean_stage_id_reference_migration.rb')
require Rails.root.join('db', 'post_migrate', '20170628080858_migrate_stage_id_reference_in_background')
describe CleanStageIdReferenceMigration, :migration, :sidekiq, :redis do describe CleanStageIdReferenceMigration, :migration, :sidekiq, :redis do
let(:migration) { MigrateStageIdReferenceInBackground::MIGRATION } let(:migration) { MigrateStageIdReferenceInBackground::MIGRATION }
context 'when there are pending background migrations' do context 'when there are pending background migrations' do
it 'processes enqueued jobs synchronously' do it 'processes pending jobs synchronously' do
Sidekiq::Testing.disable! do Sidekiq::Testing.disable! do
BackgroundMigrationWorker.perform_in(2.minutes, migration, [1]) BackgroundMigrationWorker.perform_in(2.minutes, migration, [1])
BackgroundMigrationWorker.perform_async(migration, [1]) BackgroundMigrationWorker.perform_async(migration, [1])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment