class CreatePermissionPolicies < ActiveRecord::Migration[5.2] def up if !table_exists?(:permission_policies) create_table :permission_policies do |t| t.belongs_to :resource, polymorphic: true, index: false t.string :policy_type t.timestamps end add_index :permission_policies, [:resource_type, :resource_id], unique: true end end end