2007-01-31 23:57:01 +03:00
|
|
|
class AddRolePosition < ActiveRecord::Migration
|
|
|
|
def self.up
|
2007-10-23 01:07:13 +04:00
|
|
|
add_column :roles, :position, :integer, :default => 1
|
2007-01-31 23:57:01 +03:00
|
|
|
Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)}
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
|
|
|
remove_column :roles, :position
|
|
|
|
end
|
|
|
|
end
|