添加项目动态数迁移

This commit is contained in:
huang 2016-01-12 15:18:40 +08:00
parent 8758235364
commit a74e5f9d30
2 changed files with 5 additions and 4 deletions

View File

@ -3,10 +3,10 @@ class StaticProjectActs < ActiveRecord::Migration
Project.all.each do |project|
acts = ForgeActivity.where("project_id = ?", project.id)
unless acts.blank?
acts_count = acts.count
count = acts.count
puts project.id
puts "acts_count is #{acts_count}"
project.update_attribute(:acts_count, acts_count)
puts "acts_count is #{count}"
project.update_attribute(:acts_count, count)
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160111065530) do
ActiveRecord::Schema.define(:version => 20160111080914) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1415,6 +1415,7 @@ ActiveRecord::Schema.define(:version => 20160111065530) do
t.integer "attachments_count", :default => 0
t.integer "boards_count", :default => 0
t.integer "news_count", :default => 0
t.integer "acts_count", :default => 0
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"