blob: 1587eee06ae2f8f38bc7c89dc0bdcb02cb8fa068 (
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
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
|