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

15 lines
348 B
Ruby

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