diff options
Diffstat (limited to 'db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb')
-rw-r--r-- | db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb b/db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb deleted file mode 100644 index 5fc5a5b2b6e..00000000000 --- a/db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class BackfillTotalTupleCountForBatchedMigrations < ActiveRecord::Migration[6.0] - DOWNTIME = false - - def up - return unless should_run? - - Gitlab::Database::BackgroundMigration::BatchedMigration.all.each do |migration| - total_tuple_count = Gitlab::Database::PgClass.for_table(migration.table_name)&.cardinality_estimate - - migration.update(total_tuple_count: total_tuple_count) - end - end - - def down - return unless should_run? - - Gitlab::Database::BackgroundMigration::BatchedMigration.update_all(total_tuple_count: nil) - end - - private - - def should_run? - Gitlab.dev_or_test_env? || Gitlab.com? - end -end |