diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-22 21:09:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-22 21:09:52 +0300 |
commit | db061f44328ca45f713eaf22d92aae8e76148fda (patch) | |
tree | 56f1297f970cb41a13e27cae12f5e9665957c885 /spec/migrations | |
parent | 7a7345366550f509c03595e0dada7cbd0d73103d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/cleanup_optimistic_locking_nulls_pt2_spec.rb | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/spec/migrations/cleanup_optimistic_locking_nulls_pt2_spec.rb b/spec/migrations/cleanup_optimistic_locking_nulls_pt2_spec.rb deleted file mode 100644 index 8d7d5ac2d26..00000000000 --- a/spec/migrations/cleanup_optimistic_locking_nulls_pt2_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' -require Rails.root.join('db', 'post_migrate', '20200217210353_cleanup_optimistic_locking_nulls_pt2') - -describe CleanupOptimisticLockingNullsPt2, :migration do - let(:ci_stages) { table(:ci_stages) } - let(:ci_builds) { table(:ci_builds) } - let(:ci_pipelines) { table(:ci_pipelines) } - let(:tables) { [ci_stages, ci_builds, ci_pipelines] } - - before do - # Create necessary rows - ci_stages.create! - ci_builds.create! - ci_pipelines.create! - - # Nullify `lock_version` column for all rows - # Needs to be done with a SQL fragment, otherwise Rails will coerce it to 0 - tables.each do |table| - table.update_all('lock_version = NULL') - end - end - - it 'correctly migrates nullified lock_version column', :sidekiq_might_not_need_inline do - tables.each do |table| - expect(table.where(lock_version: nil).count).to eq(1) - end - - tables.each do |table| - expect(table.where(lock_version: 0).count).to eq(0) - end - - migrate! - - tables.each do |table| - expect(table.where(lock_version: nil).count).to eq(0) - end - - tables.each do |table| - expect(table.where(lock_version: 0).count).to eq(1) - end - end -end |