Dienstag, 30. September 2008

Rake migrations effecting exisitng tables

Things that can done:

Adding a new table, Removing a table, Adding a column to an existing table, Removing a column, Renaming a column, Renaming a table, Adding an index, Adding a primary key.

>ruby script/generate migrtion add_price

This creates a new migration file in db/migrations

class AddPrice
...def self.up
.....add_column :products, :price, decimal, :precision => 8, :scale => 2, :default => 0

...def self.down
......remove_column :products, :price

Keine Kommentare: