Commit bfcd87d5 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '348269-remove-ci_pending_builds-namespace_id-fk' into 'master'

Remove foreign key constraint ci_pending_builds.namespace_id

See merge request gitlab-org/gitlab!77724
parents 758308cd 668cc33a
# frozen_string_literal: true
class RemoveForeignKeyCiPendingBuildsNamespaceId < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
CONSTRAINT_NAME = 'fk_fdc0137e4a'
def up
with_lock_retries do
remove_foreign_key_if_exists(:ci_pending_builds, :namespaces, name: CONSTRAINT_NAME)
end
end
def down
add_concurrent_foreign_key :ci_pending_builds, :namespaces, column: :namespace_id, on_delete: :cascade, name: CONSTRAINT_NAME
end
end
fc44084057c5fd30f0e7918b4f856a60409f08ad1eb5c3fbc2d8ad5bad7f1ffd
\ No newline at end of file
......@@ -29884,9 +29884,6 @@ ALTER TABLE ONLY ci_daily_build_group_report_results
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_fd82eae0b9 FOREIGN KEY (head_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL;
ALTER TABLE ONLY ci_pending_builds
ADD CONSTRAINT fk_fdc0137e4a FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY project_import_data
ADD CONSTRAINT fk_ffb9ee3a10 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
......@@ -223,4 +223,9 @@ RSpec.describe Ci::PendingBuild do
end
end
end
it_behaves_like 'cleanup by a loose foreign key' do
let!(:parent) { create(:namespace) }
let!(:model) { create(:ci_pending_build, namespace: parent) }
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