2018-11-13 07:27:31 +00:00
|
|
|
class AddForeignKeyPipelineSchedulesAndPipelines < ActiveRecord::Migration[4.2]
|
2017-05-07 22:35:56 +00:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
on_delete =
|
|
|
|
if Gitlab::Database.mysql?
|
|
|
|
:nullify
|
|
|
|
else
|
|
|
|
'SET NULL'
|
|
|
|
end
|
|
|
|
|
2018-09-20 16:47:34 +00:00
|
|
|
add_concurrent_foreign_key :ci_pipelines, :ci_pipeline_schedules,
|
2017-05-07 22:35:56 +00:00
|
|
|
column: :pipeline_schedule_id, on_delete: on_delete
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_foreign_key :ci_pipelines, column: :pipeline_schedule_id
|
|
|
|
end
|
|
|
|
end
|