Challenge 1: A Comment Migration — Solution Command: $ rails generate migration CreateComments post_id:integer body:text author_name:string Generated migration file: # db/migrate/20260102000000_create_comments.rb class CreateComments < ActiveRecord::Migration[7.1] def change create_table :comments do |t| t.integer :post_id t.text :body t.string :author_name t.timestamps end end end Resulting db/schema.rb entry (after `rails db:migrate`): create_table "comments" do |t| t.integer "post_id" t.text "body" t.string "author_name" t.datetime "created_at" t.datetime "updated_at" end =begin Notes: - t.timestamps in the migration is what adds both created_at and updated_at to the schema automatically -- it's not something typed separately for each column, just one line covering both. - post_id is defined as a plain integer column here -- the actual relationship to Post (making it a real foreign key Active Record understands) is what the next chapter's belongs_to association adds on top of this raw column. - db/schema.rb is never edited directly -- it's entirely regenerated by Rails after rails db:migrate runs, always reflecting the combined result of every migration that has been applied so far. =end