diff options
Diffstat (limited to 'db/post_migrate/20211210140629_encrypt_static_object_token.rb')
-rw-r--r-- | db/post_migrate/20211210140629_encrypt_static_object_token.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/db/post_migrate/20211210140629_encrypt_static_object_token.rb b/db/post_migrate/20211210140629_encrypt_static_object_token.rb new file mode 100644 index 00000000000..fe4db9fc14c --- /dev/null +++ b/db/post_migrate/20211210140629_encrypt_static_object_token.rb @@ -0,0 +1,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 |