BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
zj-drop-fk-if-exists.yml
changelogs/unreleased/zj-drop-fk-if-exists.yml
+4
-0
20170425112628_remove_foreigh_key_ci_trigger_schedules.rb
...20170425112628_remove_foreigh_key_ci_trigger_schedules.rb
+10
-0
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
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