2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-08-12 11:51:59 +03:00
|
|
|
class AddDescriptionAndResourceToRoles < ActiveRecord::Migration
|
|
|
|
|
def change
|
|
|
|
|
add_column :roles, :description, :string
|
|
|
|
|
add_reference :roles, :resource, polymorphic: true
|
|
|
|
|
|
|
|
|
|
add_index(:roles, :name)
|
|
|
|
|
add_index(:roles, [:name, :resource_type, :resource_id])
|
|
|
|
|
add_index(:roles_users, [:user_id, :role_id])
|
|
|
|
|
end
|
|
|
|
|
end
|