summaryrefslogtreecommitdiff
path: root/db/post_migrate/20211210140629_encrypt_static_object_token.rb
blob: fe4db9fc14ce58a6e45430ebddec84eb97f62cf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class EncryptStaticObjectToken < Gitlab::Database::Migration[1.0]
  BATCH_SIZE = 10_000
  MIGRATION = 'EncryptStaticObjectToken'

  disable_ddl_transaction!

  def up
    queue_background_migration_jobs_by_range_at_intervals(
      define_batchable_model('users').where.not(static_object_token: nil).where(static_object_token_encrypted: nil),
      MIGRATION,
      2.minutes,
      batch_size: BATCH_SIZE,
      track_jobs: true
    )
  end

  def down
    # no ops
  end
end