socialforge/db/migrate/20160727065357_add_column_t...

17 lines
405 B
Ruby
Raw Normal View History

2016-07-27 16:43:27 +08:00
class AddColumnToMemberRole < ActiveRecord::Migration
def change
add_column :member_roles, :multi_role, :integer, :default => 0
count = MemberRole.all.count / 30 + 2
transaction do
for i in 1 ... count do i
MemberRole.page(i).per(30).each do |mr|
if mr.role_id == 3
mr.update_column('multi_role', 1)
end
end
end
end
end
end