Commit 2d3c7d29 authored by Shinya Maeda's avatar Shinya Maeda

Use batch update for Service deactivation

parent 8bc3221f
...@@ -140,10 +140,11 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati ...@@ -140,10 +140,11 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
Gitlab::Database.bulk_insert('cluster_projects', rows_for_cluster_projects) Gitlab::Database.bulk_insert('cluster_projects', rows_for_cluster_projects)
end end
connection.execute <<~SQL MigrateKubernetesServiceToNewClustersArchitectures::Service
UPDATE services SET active = false .where(category: 'deployment', type: 'KubernetesService', template: false)
WHERE category = 'deployment' AND type = 'KubernetesService' AND template = false .each_batch(of: 100) do |batch|
SQL batch.update_all(active: false)
end
end end
def down 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