Browse Source

reset_project_counters

tags/v1.0.0
sylor_huang@126.com 6 years ago
parent
commit
a77310b79f
2 changed files with 13 additions and 9 deletions
  1. +0
    -9
      db/migrate/20200716055018_reset_project_issues_counte.rb
  2. +13
    -0
      db/migrate/20200716060536_change_projects_default_count.rb

+ 0
- 9
db/migrate/20200716055018_reset_project_issues_counte.rb View File

@@ -1,9 +0,0 @@
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

+ 13
- 0
db/migrate/20200716060536_change_projects_default_count.rb View File

@@ -0,0 +1,13 @@
class ChangeProjectsDefaultCount < ActiveRecord::Migration[5.2]
def change
projects = Project.select(:id, :issues_count,:pull_requests_count,:versions_count,:praises_count,:watchers_count).all
projects.each do |p|
puts p.id
Project.reset_counters( p.id, :issues_count, touch: false )
Project.reset_counters( p.id, :pull_requests_count, touch: false )
Project.reset_counters( p.id, :versions_count, touch: false )
# Project.reset_counters( p.id, :praises_count, touch: false )
Project.reset_counters( p.id, :watchers_count, touch: false )
end
end
end

Loading…
Cancel
Save