rosa-build/db/migrate/20120126214421_add_projects...

16 lines
381 B
Ruby
Raw Normal View History

# -*- encoding : utf-8 -*-
class AddProjectsCountToUsers < ActiveRecord::Migration
def self.up
add_column :users, :own_projects_count, :integer, :default => 0, :null => false
User.reset_column_information
User.all.each do |user|
User.reset_counters(user.id, :own_projects)
end
end
def self.down
remove_column :users, :own_projects_count
end
end