blob: d89c4c61cbe5ba0219419861910df0328de2d16c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
class RemoveForeighKeyCiTriggerSchedules < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
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
|