ActiveRecord requires that each table has a primary key. By default it is called "id". You do not need to add it to your migrations.
If you create a link to another table, you will need to create the referenced columns somewhat manually. You can either do t.integer :user_id , or (my preference) t.belongs_to :user . The latter is slower because Rails will call ActiveRecord to determine how to invoke the user link column.
source share