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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
358662a9
Commit
358662a9
authored
Jun 01, 2017
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zj-drop-fk-if-exists' into 'master'
Only remove FK if it exists See merge request !11828
parents
b4103229
c4067ed6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
changelogs/unreleased/zj-drop-fk-if-exists.yml
changelogs/unreleased/zj-drop-fk-if-exists.yml
+4
-0
db/migrate/20170425112628_remove_foreigh_key_ci_trigger_schedules.rb
...20170425112628_remove_foreigh_key_ci_trigger_schedules.rb
+11
-1
No files found.
changelogs/unreleased/zj-drop-fk-if-exists.yml
0 → 100644
View file @
358662a9
---
title
:
Remove foreigh key on ci_trigger_schedules only if it exists
merge_request
:
author
:
db/migrate/20170425112628_remove_foreigh_key_ci_trigger_schedules.rb
View file @
358662a9
...
...
@@ -4,10 +4,20 @@ class RemoveForeighKeyCiTriggerSchedules < ActiveRecord::Migration
DOWNTIME
=
false
def
up
remove_foreign_key
:ci_trigger_schedules
,
column: :trigger_id
if
fk_on_trigger_schedules?
remove_foreign_key
:ci_trigger_schedules
,
column: :trigger_id
end
end
def
down
# no op, the foreign key should not have been here
end
private
# Not made more generic and lifted to the helpers as Rails 5 will provide
# such an API
def
fk_on_trigger_schedules?
connection
.
foreign_keys
(
:ci_trigger_schedules
).
include?
(
"ci_triggers"
)
end
end
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