summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220412143552_consume_remaining_encrypt_integration_property_jobs.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20220412143552_consume_remaining_encrypt_integration_property_jobs.rb')
-rw-r--r--db/post_migrate/20220412143552_consume_remaining_encrypt_integration_property_jobs.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/db/post_migrate/20220412143552_consume_remaining_encrypt_integration_property_jobs.rb b/db/post_migrate/20220412143552_consume_remaining_encrypt_integration_property_jobs.rb
new file mode 100644
index 00000000000..69850b3a32f
--- /dev/null
+++ b/db/post_migrate/20220412143552_consume_remaining_encrypt_integration_property_jobs.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class ConsumeRemainingEncryptIntegrationPropertyJobs < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ BATCH_SIZE = 50
+
+ def up
+ Gitlab::BackgroundMigration.steal('EncryptIntegrationProperties')
+
+ model = define_batchable_model('integrations')
+ relation = model.where.not(properties: nil).where(encrypted_properties: nil)
+
+ relation.each_batch(of: BATCH_SIZE) do |batch|
+ range = batch.pluck('MIN(id)', 'MAX(id)').first
+
+ Gitlab::BackgroundMigration::EncryptIntegrationProperties.new.perform(*range)
+ end
+ end
+
+ def down
+ end
+end