Commit 3f464f16 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'fix-project-deletion-timeout' into 'master'

Reorder source_project_id foreign key constraint

See merge request gitlab-org/gitlab!60313
parents 275dc7f3 6518666b
---
title: Reorder source_project_id foreign key constraint in merge_requests table
merge_request: 60313
author:
type: changed
# frozen_string_literal: true
class ReOrderFkSourceProjectIdInMergeRequests < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
OLD_SOURCE_PROJECT_FK = 'fk_3308fe130c'
NEW_SOURCE_PROJECT_FK = 'fk_source_project'
def up
add_concurrent_foreign_key :merge_requests, :projects, column: :source_project_id, on_delete: :nullify, name: NEW_SOURCE_PROJECT_FK
remove_foreign_key_if_exists :merge_requests, column: :source_project_id, name: OLD_SOURCE_PROJECT_FK
end
def down
add_concurrent_foreign_key :merge_requests, :projects, column: :source_project_id, on_delete: :nullify
remove_foreign_key_if_exists :merge_requests, column: :source_project_id, name: NEW_SOURCE_PROJECT_FK
end
end
06ead319cbc56b25769ed06b6a246d705b467d34a5d09ab9282e2d83c55511ba
\ No newline at end of file
......@@ -25068,9 +25068,6 @@ ALTER TABLE ONLY approvals
ALTER TABLE ONLY namespaces
ADD CONSTRAINT fk_319256d87a FOREIGN KEY (file_template_project_id) REFERENCES projects(id) ON DELETE SET NULL;
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_3308fe130c FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL;
ALTER TABLE ONLY ci_group_variables
ADD CONSTRAINT fk_33ae4d58d8 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
......@@ -27159,6 +27156,9 @@ ALTER TABLE ONLY ci_builds_metadata
ALTER TABLE ONLY services
ADD CONSTRAINT fk_services_inherit_from_id FOREIGN KEY (inherit_from_id) REFERENCES services(id) ON DELETE CASCADE;
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_source_project FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL;
ALTER TABLE ONLY timelogs
ADD CONSTRAINT fk_timelogs_issues_issue_id FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
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