class CreateActivities < ActiveRecord::Migration def change create_table :activities, :id => false do |t| t.integer :act_id, :null => false t.string :act_type, :null => false t.integer :user_id, :null => false end add_index :activities, :user_id add_index :activities, [:act_id, :act_type] add_index :activities, [:user_id, :act_type] end end