// Suppose we have a Post model with body:integer and title:string columns. Generate a migration to add a user_id column to the posts table.
$ rails g migration AddUserIdToPosts
// Update the migration file, so the $ rake db:migrate command will add the user_id column to the posts table.
class AddUserIdToPosts < ActiveRecord::Migration
def change
add_column :posts, :user_id, :integer
end
end