Migrations now have a timestamp as their version number in Rails 2.1. In this episode I will explain this change as well as show you some other cool additions.
# in a migration file
def self.up
change_table :products do |t|
t.rename :released_on, :released_at
t.change :description, :text, :limit => nil, :null => true
t.remove :price
t.integer :stock_quantity
end
end
def self.down
change_table :products do |t|
t.rename :released_at, :released_on
t.change :description, :string, :null => false
t.decimal :price, :precision => 10, :scale => 2
t.remove :stock_quantity
end
end