debian-mirror-gitlab/spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
847 B
Ruby
Raw Normal View History

2021-11-11 11:23:49 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-12-11 22:18:48 +05:30
require_migration!
2021-11-11 11:23:49 +05:30
2023-03-04 22:38:38 +05:30
RSpec.describe FinalizeCiBuildsBigintConversion, :migration, schema: 20210907182359, feature_category: :continuous_integration do
2021-11-11 11:23:49 +05:30
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