To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / db / migrate / 020_add_role_position.rb @ 443:350acce374a2

History | View | Annotate | Download (275 Bytes)

1
class AddRolePosition < ActiveRecord::Migration
2
  def self.up
3
    add_column :roles, :position, :integer, :default => 1
4
    Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)}
5
  end
6

    
7
  def self.down
8
    remove_column :roles, :position
9
  end
10
end