blob: 489403f42bf0f7dff22b077599d99af9e7c4ab6c (
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
25
26
27
28
29
30
31
|
# frozen_string_literal: true
class CleanupCiPipelinesAutoCanceledByIdBigint < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone "16.7"
TABLE = :ci_pipelines
REFERENCING_TABLE = :ci_pipelines
COLUMN = :auto_canceled_by_id
OLD_COLUMN = :auto_canceled_by_id_convert_to_bigint
INDEX_NAME = :index_ci_pipelines_on_auto_canceled_by_id_bigint
OLD_FK_NAME = :fk_67e4288f3a
def up
with_lock_retries(raise_on_exhaustion: true) do
cleanup_conversion_of_integer_to_bigint(TABLE, [COLUMN])
end
end
def down
restore_conversion_of_integer_to_bigint(TABLE, [COLUMN])
add_concurrent_index(TABLE, OLD_COLUMN, name: INDEX_NAME)
add_concurrent_foreign_key(
TABLE, TABLE,
column: OLD_COLUMN, name: OLD_FK_NAME,
on_delete: :nullify, validate: true, reverse_lock_order: true
)
end
end
|