2012-01-31 16:40:46 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2012-01-26 22:33:18 +00:00
|
|
|
class AddProjectsCountToGroups < ActiveRecord::Migration
|
|
|
|
def self.up
|
|
|
|
add_column :groups, :own_projects_count, :integer, :default => 0, :null => false
|
|
|
|
|
|
|
|
Group.reset_column_information
|
|
|
|
Group.all.each do |group|
|
|
|
|
Group.reset_counters(group.id, :own_projects)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
2012-01-27 14:38:33 +00:00
|
|
|
remove_column :groups, :own_projects_count
|
2012-01-26 22:33:18 +00:00
|
|
|
end
|
|
|
|
end
|