Created
December 7, 2009 10:25
-
-
Save tomoya55/250750 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| migration 1, :create_people_table do | |
| up do | |
| puts "up" | |
| create_table :people do | |
| column :id, Integer, :serial => true | |
| column :name, String, :size => 50 | |
| column :age, Integer | |
| end | |
| end | |
| down do | |
| drop_table :people | |
| end | |
| end | |
| migration 2, :add_extra_props_people do | |
| up do | |
| modify_table :people do | |
| add_column :extra, String, :nullable? => true | |
| end | |
| end | |
| down do | |
| modify_table :people do | |
| drop_column :extra | |
| end | |
| end | |
| end | |
| migration 3, :rename_age_to_birthyear do | |
| up do | |
| execute 'ALTER TABLE people CHANGE COLUMN `age` `birthyear` INTEGER DEFAULT 0' | |
| end | |
| down do | |
| execute 'ALTER TABLE people CHANGE COLUMN `birthyear` `age` INTEGER DEFAULT 0' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment