class CreateProjectTrends < ActiveRecord::Migration[5.2] def change create_table :project_trends do |t| t.integer :user_id t.integer :project_id t.references :trend, polymorphic: true, index: true t.string :action_type t.timestamps end add_index :project_trends, [:user_id, :project_id] end end