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
Boxiang Sun
gitlab-ce
Commits
c4067ed6
Commit
c4067ed6
authored
May 31, 2017
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only remove FK if it exists
parent
a8901ce6
Changes
2
Show 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 @
c4067ed6
---
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 @
c4067ed6
...
...
@@ -4,10 +4,20 @@ class RemoveForeighKeyCiTriggerSchedules < ActiveRecord::Migration
DOWNTIME
=
false
def
up
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