diff options
Diffstat (limited to 'db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb')
-rw-r--r-- | db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb b/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb new file mode 100644 index 00000000000..972df41f678 --- /dev/null +++ b/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class BackfillCiBuildsForBigintConversion < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + TABLE = :ci_builds + COLUMNS = %i(id stage_id).freeze + + def up + return unless should_run? + + backfill_conversion_of_integer_to_bigint TABLE, COLUMNS, batch_size: 15000, sub_batch_size: 100 + end + + def down + return unless should_run? + + revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS + end + + private + + def should_run? + Gitlab.dev_or_test_env? || Gitlab.com? + end +end |