Commit 5d8150fe authored by Tiger Watson's avatar Tiger Watson

Merge branch '283938_cascade_delete_inheriting_services' into 'master'

Cascade delete inheriting services

See merge request gitlab-org/gitlab!48163
parents e08701cb ea3fb7ea
---
title: Change services.inherit_from_id foreign key to ON DELETE CASCADE
merge_request: 48163
author:
type: fixed
# frozen_string_literal: true
class ChangeServicesInheritFromIdForeignKey < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :cascade, name: 'fk_services_inherit_from_id'
remove_foreign_key_if_exists :services, name: 'fk_868a8e7ad6'
end
def down
remove_foreign_key_if_exists :services, name: 'fk_services_inherit_from_id'
add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :nullify, name: 'fk_868a8e7ad6'
end
end
c41f4649540c23d25f0ae26c3754476409b5e77f53b96db65f2c1fd4a6caf087
\ No newline at end of file
...@@ -23112,9 +23112,6 @@ ALTER TABLE ONLY merge_request_diffs ...@@ -23112,9 +23112,6 @@ ALTER TABLE ONLY merge_request_diffs
ALTER TABLE ONLY ci_pipelines ALTER TABLE ONLY ci_pipelines
ADD CONSTRAINT fk_86635dbd80 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; ADD CONSTRAINT fk_86635dbd80 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY services
ADD CONSTRAINT fk_868a8e7ad6 FOREIGN KEY (inherit_from_id) REFERENCES services(id) ON DELETE SET NULL;
ALTER TABLE ONLY geo_event_log ALTER TABLE ONLY geo_event_log
ADD CONSTRAINT fk_86c84214ec FOREIGN KEY (repository_renamed_event_id) REFERENCES geo_repository_renamed_events(id) ON DELETE CASCADE; ADD CONSTRAINT fk_86c84214ec FOREIGN KEY (repository_renamed_event_id) REFERENCES geo_repository_renamed_events(id) ON DELETE CASCADE;
...@@ -24780,6 +24777,9 @@ ALTER TABLE ONLY resource_label_events ...@@ -24780,6 +24777,9 @@ ALTER TABLE ONLY resource_label_events
ALTER TABLE ONLY ci_builds_metadata ALTER TABLE ONLY ci_builds_metadata
ADD CONSTRAINT fk_rails_ffcf702a02 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; ADD CONSTRAINT fk_rails_ffcf702a02 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
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 timelogs ALTER TABLE ONLY timelogs
ADD CONSTRAINT fk_timelogs_issues_issue_id FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; 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