Commit c7121f96 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'id-skip-any-approval-migrations-for-foss' into 'master'

Skip running any approval migrations for FOSS

See merge request gitlab-org/gitlab!17921
parents f7eccd9a 216b5c93
...@@ -22,6 +22,8 @@ class ScheduleProjectAnyApprovalRuleMigration < ActiveRecord::Migration[5.2] ...@@ -22,6 +22,8 @@ class ScheduleProjectAnyApprovalRuleMigration < ActiveRecord::Migration[5.2]
end end
def up def up
return unless Gitlab.ee?
add_concurrent_index :projects, :id, add_concurrent_index :projects, :id,
name: 'tmp_projects_with_approvals_before_merge', name: 'tmp_projects_with_approvals_before_merge',
where: 'approvals_before_merge <> 0' where: 'approvals_before_merge <> 0'
......
...@@ -22,6 +22,8 @@ class ScheduleMergeRequestAnyApprovalRuleMigration < ActiveRecord::Migration[5.2 ...@@ -22,6 +22,8 @@ class ScheduleMergeRequestAnyApprovalRuleMigration < ActiveRecord::Migration[5.2
end end
def up def up
return unless Gitlab.ee?
add_concurrent_index :merge_requests, :id, add_concurrent_index :merge_requests, :id,
name: 'tmp_merge_requests_with_approvals_before_merge', name: 'tmp_merge_requests_with_approvals_before_merge',
where: 'approvals_before_merge <> 0' where: 'approvals_before_merge <> 0'
......
...@@ -48,4 +48,22 @@ describe ScheduleMergeRequestAnyApprovalRuleMigration, :migration, :sidekiq do ...@@ -48,4 +48,22 @@ describe ScheduleMergeRequestAnyApprovalRuleMigration, :migration, :sidekiq do
end end
end end
end end
context 'for FOSS version' do
before do
allow(Gitlab).to receive(:ee?).and_return(false)
end
it 'does not schedule any jobs' do
create_merge_request(2)
Sidekiq::Testing.fake! do
Timecop.freeze do
migrate!
expect(BackgroundMigrationWorker.jobs.size).to eq(0)
end
end
end
end
end end
...@@ -43,4 +43,22 @@ describe ScheduleProjectAnyApprovalRuleMigration, :migration, :sidekiq do ...@@ -43,4 +43,22 @@ describe ScheduleProjectAnyApprovalRuleMigration, :migration, :sidekiq do
end end
end end
end end
context 'for FOSS version' do
before do
allow(Gitlab).to receive(:ee?).and_return(false)
end
it 'does not schedule any jobs' do
create_project(2)
Sidekiq::Testing.fake! do
Timecop.freeze do
migrate!
expect(BackgroundMigrationWorker.jobs.size).to eq(0)
end
end
end
end
end end
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