Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ea3fb7ea
Commit
ea3fb7ea
authored
Nov 27, 2020
by
Andy Soiron
Committed by
Tiger Watson
Nov 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cascade delete inheriting services
parent
3549441a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
3 deletions
+28
-3
changelogs/unreleased/283938_cascade_delete_inheriting_services.yml
.../unreleased/283938_cascade_delete_inheriting_services.yml
+5
-0
db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb
...1119162801_change_services_inherit_from_id_foreign_key.rb
+19
-0
db/schema_migrations/20201119162801
db/schema_migrations/20201119162801
+1
-0
db/structure.sql
db/structure.sql
+3
-3
No files found.
changelogs/unreleased/283938_cascade_delete_inheriting_services.yml
0 → 100644
View file @
ea3fb7ea
---
title
:
Change services.inherit_from_id foreign key to ON DELETE CASCADE
merge_request
:
48163
author
:
type
:
fixed
db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb
0 → 100644
View file @
ea3fb7ea
# 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
db/schema_migrations/20201119162801
0 → 100644
View file @
ea3fb7ea
c41f4649540c23d25f0ae26c3754476409b5e77f53b96db65f2c1fd4a6caf087
\ No newline at end of file
db/structure.sql
View file @
ea3fb7ea
...
...
@@ -23124,9 +23124,6 @@ ALTER TABLE ONLY merge_request_diffs
ALTER TABLE ONLY ci_pipelines
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
ADD CONSTRAINT fk_86c84214ec FOREIGN KEY (repository_renamed_event_id) REFERENCES geo_repository_renamed_events(id) ON DELETE CASCADE;
...
...
@@ -24792,6 +24789,9 @@ ALTER TABLE ONLY resource_label_events
ALTER TABLE ONLY ci_builds_metadata
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
ADD CONSTRAINT fk_timelogs_issues_issue_id FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment