From de1e748e25bb4f81d1244929cfa36475e95e8e5f Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Thu, 16 Jul 2020 13:55:25 +0800 Subject: [PATCH] reset issues_count --- db/migrate/20200716055018_reset_project_issues_counte.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20200716055018_reset_project_issues_counte.rb diff --git a/db/migrate/20200716055018_reset_project_issues_counte.rb b/db/migrate/20200716055018_reset_project_issues_counte.rb new file mode 100644 index 000000000..15af620c4 --- /dev/null +++ b/db/migrate/20200716055018_reset_project_issues_counte.rb @@ -0,0 +1,9 @@ +class ResetProjectIssuesCounte < ActiveRecord::Migration[5.2] + def change + projects = Project.select(:id, :issues_count).all + projects.each do |p| + puts p.id + Project.reset_counters( p.id, :issues_count, touch: false ) + end + end +end