1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-02 13:24:20 +01:00
fab-manager/db/migrate/20140409083610_rolify_create_roles.rb

22 lines
482 B
Ruby
Raw Normal View History

# frozen_string_literal:true
class RolifyCreateRoles < ActiveRecord::Migration[4.2]
2015-05-05 03:10:25 +02:00
def change
create_table(:roles) do |t|
t.string :name
t.references :resource, polymorphic: true
2015-05-05 03:10:25 +02:00
t.timestamps
end
create_table(:users_roles, id: false) do |t|
2015-05-05 03:10:25 +02:00
t.references :user
t.references :role
end
add_index(:roles, :name)
add_index(:roles, %i[name resource_type resource_id])
add_index(:users_roles, %i[user_id role_id])
2015-05-05 03:10:25 +02:00
end
end