diff options
Diffstat (limited to 'db/post_migrate/20190812070645_migrate_private_profile_nulls.rb')
-rw-r--r-- | db/post_migrate/20190812070645_migrate_private_profile_nulls.rb | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/db/post_migrate/20190812070645_migrate_private_profile_nulls.rb b/db/post_migrate/20190812070645_migrate_private_profile_nulls.rb deleted file mode 100644 index 063c1e16c27..00000000000 --- a/db/post_migrate/20190812070645_migrate_private_profile_nulls.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class MigratePrivateProfileNulls < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - DELAY = 5.minutes.to_i - BATCH_SIZE = 1_000 - - disable_ddl_transaction! - - class User < ActiveRecord::Base - self.table_name = 'users' - - include ::EachBatch - end - - def up - # Migration will take about 7 hours - User.where(private_profile: nil).each_batch(of: BATCH_SIZE) do |batch, index| - range = batch.pluck(Arel.sql("MIN(id)"), Arel.sql("MAX(id)")).first - delay = index * DELAY - - BackgroundMigrationWorker.perform_in(delay.seconds, 'MigrateNullPrivateProfileToFalse', [*range]) - end - end - - def down - # noop - end -end |