class CreateApprovalItems < ActiveRecord::Migration[5.1] def change create_table :approval_items do |t| t.integer :request_id, null: false t.integer :resource_id t.string :resource_type, null: false t.string :event, null: false t.text :params t.timestamps t.index :request_id end add_index :approval_items, [:resource_id, :resource_type] end end