Remove migration dependency from stage_id migration

This commit is contained in:
Grzegorz Bizon 2017-07-18 11:51:47 +02:00
parent 2930c0e3d0
commit 73c7b96885
2 changed files with 3 additions and 5 deletions

View file

@ -1,5 +1,3 @@
require Rails.root.join('db', 'post_migrate', '20170628080858_migrate_stage_id_reference_in_background')
class CleanStageIdReferenceMigration < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
@ -11,8 +9,7 @@ class CleanStageIdReferenceMigration < ActiveRecord::Migration
# `MigrateStageIdReferenceInBackground` background migration cleanup.
#
def up
Gitlab::BackgroundMigration
.steal(MigrateStageIdReferenceInBackground::MIGRATION)
Gitlab::BackgroundMigration.steal('MigrateBuildStageIdReference')
end
def down

View file

@ -1,11 +1,12 @@
require 'spec_helper'
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
let(:migration) { MigrateStageIdReferenceInBackground::MIGRATION }
context 'when there are pending background migrations' do
it 'processes enqueued jobs synchronously' do
it 'processes pending jobs synchronously' do
Sidekiq::Testing.disable! do
BackgroundMigrationWorker.perform_in(2.minutes, migration, [1])
BackgroundMigrationWorker.perform_async(migration, [1])