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

15 lines
356 B
Ruby
Raw Permalink Normal View History

class AddProjectsCountToGroups < ActiveRecord::Migration
def self.up
2014-01-21 04:51:49 +00:00
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
end
end