Commit 74ccb590 authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Merge branch 'lfk_ci_pending_builds_to_projects' into 'master'

Add LFK ci_pending_builds to projects, remove FK ci_pending_builds to projects

See merge request gitlab-org/gitlab!78010
parents 638167a4 671e495b
# frozen_string_literal: true
class RemoveProjectsCiPendingBuildsFk < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
with_lock_retries do
remove_foreign_key_if_exists(:ci_pending_builds, :projects, name: "fk_rails_480669c3b3")
end
end
def down
add_concurrent_foreign_key(:ci_pending_builds, :projects, name: "fk_rails_480669c3b3", column: :project_id, target_column: :id, on_delete: "cascade")
end
end
0cb120b0036b3f472edb57fcb8a52877d399edf8ff1f416ce76497d6aa8265d7
\ No newline at end of file
......@@ -30362,9 +30362,6 @@ ALTER TABLE ONLY vulnerability_feedback
ALTER TABLE ONLY user_custom_attributes
ADD CONSTRAINT fk_rails_47b91868a8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_pending_builds
ADD CONSTRAINT fk_rails_480669c3b3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY upcoming_reconciliations
ADD CONSTRAINT fk_rails_497b4938ac FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
......@@ -43,6 +43,9 @@ ci_pending_builds:
- table: namespaces
column: namespace_id
on_delete: async_delete
- table: projects
column: project_id
on_delete: async_delete
ci_resource_groups:
- table: projects
column: project_id
......
......@@ -228,4 +228,9 @@ RSpec.describe Ci::PendingBuild do
let!(:parent) { create(:namespace) }
let!(:model) { create(:ci_pending_build, namespace: parent) }
end
it_behaves_like 'cleanup by a loose foreign key' do
let!(:parent) { create(:project) }
let!(:model) { create(:ci_pending_build, project: 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