Commit 87ca3996 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '348269-remove-ci_daily_build_group_report_results-group_id-fk' into 'master'

Remove foreign key ci_daily_build_group_report_results.group_id

See merge request gitlab-org/gitlab!77721
parents 8cf56177 d801789b
# 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