diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-01-05 23:24:51 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-01-08 16:22:18 +0900 |
commit | 2d3c7d29b2950110f51cde9b6c8c39f9d7404884 (patch) | |
tree | 387ba93ff16adefcff30c2b7385ba2bd3c320c33 | |
parent | 8bc3221f2fe096e6c1f2070a2fcdb18903c2c599 (diff) | |
download | gitlab-ce-2d3c7d29b2950110f51cde9b6c8c39f9d7404884.tar.gz |
Use batch update for Service deactivation
-rw-r--r-- | db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb b/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb index aff934c2ab4..2808c8e0222 100644 --- a/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb +++ b/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb @@ -140,10 +140,11 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati Gitlab::Database.bulk_insert('cluster_projects', rows_for_cluster_projects) end - connection.execute <<~SQL - UPDATE services SET active = false - WHERE category = 'deployment' AND type = 'KubernetesService' AND template = false - SQL + MigrateKubernetesServiceToNewClustersArchitectures::Service + .where(category: 'deployment', type: 'KubernetesService', template: false) + .each_batch(of: 100) do |batch| + batch.update_all(active: false) + end end def down |