blob: adf99e73fdb2e8d6ed0a96c5f4d352143fd6ce23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# frozen_string_literal: true
class ReplaceCiResourcesForeignKey < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
add_concurrent_foreign_key :ci_resources, :p_ci_builds,
name: 'temp_fk_e169a8e3d5_p',
column: [:partition_id, :build_id],
target_column: [:partition_id, :id],
on_update: :cascade,
on_delete: :nullify,
validate: false,
reverse_lock_order: true
prepare_async_foreign_key_validation :ci_resources,
name: 'temp_fk_e169a8e3d5_p'
end
def down
unprepare_async_foreign_key_validation :ci_resources, name: 'temp_fk_e169a8e3d5_p'
remove_foreign_key :ci_resources, name: 'temp_fk_e169a8e3d5_p'
end
end
|