Commit d801789b authored by Dylan Griffith's avatar Dylan Griffith Committed by Adam Hegyi

Remove foreign key ci_daily_build_group_report_results.group_id

The loose foreign key was already added for this in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77636 . We've
already determined in
https://gitlab.com/gitlab-org/gitlab/-/issues/348269 it is safe to
change this foreign key to a loose foreign key.

Changelog: other
parent 4b8a9c0d
# frozen_string_literal: true
class RemoveForeignKeyCiDailyBuildGroupReportResultsGroupId < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
CONSTRAINT_NAME = 'fk_fd1858fefd'
def up
with_lock_retries do
remove_foreign_key_if_exists(:ci_daily_build_group_report_results, :namespaces, name: CONSTRAINT_NAME)
end
end
def down
add_concurrent_foreign_key :ci_daily_build_group_report_results, :namespaces, column: :group_id, on_delete: :cascade, name: CONSTRAINT_NAME
end
end
aafb52337688e8b57712872f6f7e8e67da132406b244df5e11a736b01e23354f
\ No newline at end of file
......@@ -29884,9 +29884,6 @@ ALTER TABLE ONLY system_note_metadata
ALTER TABLE ONLY vulnerability_remediations
ADD CONSTRAINT fk_fc61a535a0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_daily_build_group_report_results
ADD CONSTRAINT fk_fd1858fefd FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_fd82eae0b9 FOREIGN KEY (head_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL;
......@@ -164,4 +164,10 @@ RSpec.describe Ci::DailyBuildGroupReportResult do
end
end
end
it_behaves_like 'cleanup by a loose foreign key' do
let!(:model) { create(:ci_daily_build_group_report_result) }
let!(:parent) { model.group }
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