[Rails] Migration newbie

Pål Bergström pal at palbergstrom.com
Thu Aug 17 18:29:52 GMT 2006


In an migration file there is one up and one down method. Below is from 
Agile Web Development with Rails:

class CreateOrderHistories < ActiveRecord::Migration
def self.up
create_table :order_histories do |t|
t.column :order_id, :integer, :null => false
t.column :created_at, :timestamp
t.column :notes, :text
end
end
def self.down
drop_table :order_histories
end
end

Why is there a drop table in the same file? Will that not delete the 
same table just created?

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list