Commit 6f194bfc authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'remove-projects_ci_freeze_periods_project_id-fk' into 'master'

Swap FK ci_freeze_periods to projects for LFK

See merge request gitlab-org/gitlab!78155
parents d2caed34 84bac952
# frozen_string_literal: true
class RemoveProjectsCiFreezePeriodsProjectIdFk < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
with_lock_retries do
remove_foreign_key_if_exists(:ci_freeze_periods, :projects, name: "fk_2e02bbd1a6")
end
end
def down
add_concurrent_foreign_key(:ci_freeze_periods, :projects, name: "fk_2e02bbd1a6", column: :project_id, target_column: :id, on_delete: "cascade")
end
end
ccfbbbe52b27833453f867c4d7093187d21dbbfebe054b366ff010c54de50974
\ No newline at end of file
...@@ -29171,9 +29171,6 @@ ALTER TABLE ONLY agent_group_authorizations ...@@ -29171,9 +29171,6 @@ ALTER TABLE ONLY agent_group_authorizations
ALTER TABLE ONLY deployment_approvals ALTER TABLE ONLY deployment_approvals
ADD CONSTRAINT fk_2d060dfc73 FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE; ADD CONSTRAINT fk_2d060dfc73 FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_freeze_periods
ADD CONSTRAINT fk_2e02bbd1a6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY notes ALTER TABLE ONLY notes
ADD CONSTRAINT fk_2e82291620 FOREIGN KEY (review_id) REFERENCES reviews(id) ON DELETE SET NULL; ADD CONSTRAINT fk_2e82291620 FOREIGN KEY (review_id) REFERENCES reviews(id) ON DELETE SET NULL;
---
dast_site_profiles_pipelines: dast_site_profiles_pipelines:
- table: ci_pipelines - table: ci_pipelines
column: ci_pipeline_id column: ci_pipeline_id
...@@ -34,6 +35,10 @@ ci_daily_build_group_report_results: ...@@ -34,6 +35,10 @@ ci_daily_build_group_report_results:
- table: namespaces - table: namespaces
column: group_id column: group_id
on_delete: async_delete on_delete: async_delete
ci_freeze_periods:
- table: projects
column: project_id
on_delete: async_delete
ci_pending_builds: ci_pending_builds:
- table: namespaces - table: namespaces
column: namespace_id column: namespace_id
......
...@@ -5,6 +5,11 @@ require 'spec_helper' ...@@ -5,6 +5,11 @@ require 'spec_helper'
RSpec.describe Ci::FreezePeriod, type: :model do RSpec.describe Ci::FreezePeriod, type: :model do
subject { build(:ci_freeze_period) } subject { build(:ci_freeze_period) }
it_behaves_like 'cleanup by a loose foreign key' do
let!(:parent) { create(:project) }
let!(:model) { create(:ci_freeze_period, project: parent) }
end
let(:invalid_cron) { '0 0 0 * *' } let(:invalid_cron) { '0 0 0 * *' }
it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:project) }
......
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