2007-01-31 20:57:01 +00:00
|
|
|
class AddRolePosition < ActiveRecord::Migration
|
|
|
|
def self.up
|
2007-10-22 21:07:13 +00:00
|
|
|
add_column :roles, :position, :integer, :default => 1
|
2011-12-14 22:24:20 +00:00
|
|
|
Role.all.each_with_index {|role, i| role.update_attribute(:position, i+1)}
|
2007-01-31 20:57:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
|
|
|
remove_column :roles, :position
|
|
|
|
end
|
|
|
|
end
|