work>ruby script/generate model product
the generator creates a bunch of files. The two we're interested in are the model itself product.rb, and the migration 001_create_products.rb.
In this file, there were two ruby methods.
class CretaeProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.column :title, :string
t.column :description, :text
end
def self.down
drop_table :products
end
end
get rails to apply the migration to the database.
work> rake db:migrate
if you want to roll back ,you could use
work> rake db:migrate VERSION=0
and the products table will gone.
call the rake db:migrate will re-create it.