17 lines
405 B
Ruby
17 lines
405 B
Ruby
|
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
|