class CreateCollections < ActiveRecord::Migration[5.2] def change create_table :collections do |t| t.references :user, index: true t.integer :container_id t.string :container_type t.timestamps end add_index :collections, [:container_type, :container_id] end end