Commit 1118c7f3 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '348269-remove-foreign-key-ci_minutes_additional_packs-namespace_id' into 'master'

Remove foreign key ci_minutes_additional_packs.namespace_id

See merge request gitlab-org/gitlab!77550
parents 6beeabf8 aff84c08
# frozen_string_literal: true
class RemoveCiMinutesAdditionalPacksNamespaceIdForeignKeyConstraint < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
CONSTRAINT_NAME = 'fk_rails_e0e0c4e4b1'
def up
with_lock_retries do
remove_foreign_key_if_exists(:ci_minutes_additional_packs, :namespaces, name: CONSTRAINT_NAME)
end
end
def down
add_concurrent_foreign_key :ci_minutes_additional_packs, :namespaces, column: :namespace_id, on_delete: :cascade, name: CONSTRAINT_NAME
end
end
301c2f09f48aa3e34c2f679628a9542b4babc589e3d20e9ccf84a9209f5841ee
\ No newline at end of file
......@@ -31270,9 +31270,6 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_stages
ALTER TABLE ONLY bulk_import_export_uploads
ADD CONSTRAINT fk_rails_dfbfb45eca FOREIGN KEY (export_id) REFERENCES bulk_import_exports(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_minutes_additional_packs
ADD CONSTRAINT fk_rails_e0e0c4e4b1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY label_priorities
ADD CONSTRAINT fk_rails_e161058b0f FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;
......@@ -34,4 +34,10 @@ RSpec.describe Ci::Minutes::AdditionalPack, type: :model do
it { is_expected.not_to validate_uniqueness_of(:purchase_xid) }
end
end
it_behaves_like 'cleanup by a loose foreign key' do
let!(:model) { create(:ci_minutes_additional_pack) }
let!(:parent) { model.namespace }
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