Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20210907211557_finalize_ci_builds_bigint_conversion_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 362b4be1bc63f935cddaf5565eeaacf1d12217b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

require 'spec_helper'
require_migration!('finalize_ci_builds_bigint_conversion')

RSpec.describe FinalizeCiBuildsBigintConversion, :migration, schema: 20210907182359 do
  context 'with an unexpected FK fk_3f0c88d7dc' do
    it 'removes the FK and migrates successfully' do
      # Add the unexpected FK
      subject.add_foreign_key(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_3f0c88d7dc')

      expect { migrate! }.to change { subject.foreign_key_exists?(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_3f0c88d7dc') }.from(true).to(false)

      # Additional check: The actually expected FK should still exist
      expect(subject.foreign_key_exists?(:ci_sources_pipelines, :ci_builds, column: :source_job_id, name: 'fk_be5624bf37')).to be_truthy
    end
  end
end