mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-05 16:24:21 +01:00
20 lines
461 B
Ruby
20 lines
461 B
Ruby
|
class RolifyCreateRoles < ActiveRecord::Migration
|
||
|
def change
|
||
|
create_table(:roles) do |t|
|
||
|
t.string :name
|
||
|
t.references :resource, :polymorphic => true
|
||
|
|
||
|
t.timestamps
|
||
|
end
|
||
|
|
||
|
create_table(:users_roles, :id => false) do |t|
|
||
|
t.references :user
|
||
|
t.references :role
|
||
|
end
|
||
|
|
||
|
add_index(:roles, :name)
|
||
|
add_index(:roles, [ :name, :resource_type, :resource_id ])
|
||
|
add_index(:users_roles, [ :user_id, :role_id ])
|
||
|
end
|
||
|
end
|