beast rev 2066
[beast-modified.git] / db / migrate / 017_update_user_post_counts.rb
blob0169d97e20e007ec6dfaa122e5c834434835ff1a
1 class UpdateUserPostCounts < ActiveRecord::Migration
2   def self.up
3     # old and not needed, we only need to know post count
4     remove_column "users", "topics_count"
5     # because i think the counts have been off
6     User.find(:all).each do | i |
7       i.posts_count=i.posts.count
8       i.save
9     end
10   end
12   def self.down
13     raise IrreversibleMigration
14   end
15 end