This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
2007-12-22 19:32:08 -05:00
|
|
|
class CreateRoles < ActiveRecord::Migration
|
|
|
|
def self.up
|
|
|
|
create_table :roles do |t|
|
|
|
|
t.column :name, :string
|
|
|
|
t.column :code, :string
|
|
|
|
t.column :parent_id, :integer
|
|
|
|
end
|
|
|
|
add_index :roles, :parent_id
|
|
|
|
add_index :roles, :code
|
|
|
|
br = Role.create :code => 'base', :name => 'Base Role'
|
|
|
|
ar = Role.create :code => 'admin', :name => 'Administrative Role',
|
|
|
|
:parent_id => br.id
|
2008-02-03 15:16:53 -05:00
|
|
|
nr = Role.create :code => 'normal', :name => 'Normal User Role',
|
|
|
|
:parent_id => br.id
|
2007-12-22 19:32:08 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
|
|
|
drop_table :roles
|
|
|
|
end
|
|
|
|
end
|