summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorEtienne BaquƩ <ebaque@gitlab.com>2019-07-17 09:38:28 -0400
committerStan Hu <stanhu@gmail.com>2019-08-26 19:39:48 -0700
commita6b60fee67f6ea4d22ab5cb34901d0707829eec0 (patch)
tree43df01178e9c193770c707777f6f034f4b98d848 /db
parent3e48d419318b319ba5629669472234ec7ecd77d8 (diff)
downloadgitlab-ce-a6b60fee67f6ea4d22ab5cb34901d0707829eec0.tar.gz
Iterating through token to encrypt with find_each
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb b/db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb
index 6245a87dc62..2eb8d1ee11c 100644
--- a/db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb
+++ b/db/post_migrate/20190711201818_encrypt_deploy_tokens_tokens.rb
@@ -9,7 +9,7 @@ class EncryptDeployTokensTokens < ActiveRecord::Migration[5.1]
def up
say_with_time("Encrypting tokens from deploy_tokens") do
- DeploymentTokens.where('token_encrypted is NULL AND token IS NOT NULL').find_each do |deploy_token|
+ DeploymentTokens.where('token_encrypted is NULL AND token IS NOT NULL').find_each(batch_size: 10000) do |deploy_token|
token_encrypted = Gitlab::CryptoHelper.aes256_gcm_encrypt(deploy_token.token)
deploy_token.update!(token_encrypted: token_encrypted)
end
@@ -18,7 +18,7 @@ class EncryptDeployTokensTokens < ActiveRecord::Migration[5.1]
def down
say_with_time("Decrypting tokens from deploy_tokens") do
- DeploymentTokens.where('token_encrypted IS NOT NULL AND token IS NULL').find_each do |deploy_token|
+ DeploymentTokens.where('token_encrypted IS NOT NULL AND token IS NULL').find_each(batch_size: 10000) do |deploy_token|
token = Gitlab::CryptoHelper.aes256_gcm_decrypt(deploy_token.token_encrypted)
deploy_token.update!(token: token)
end