Use batch update for Service deactivation

This commit is contained in:
Shinya Maeda 2018-01-05 23:24:51 +09:00
parent 8bc3221f2f
commit 2d3c7d29b2

View file

@ -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