BigW Consortium Gitlab

Commit 2d3c7d29 by Shinya Maeda

Use batch update for Service deactivation

parent 8bc3221f
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment