添加项目动态数迁移
This commit is contained in:
parent
8758235364
commit
a74e5f9d30
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue