About ruby on rails, hackintosh, iphone3g and etc.

Wednesday, January 7, 2009

Using rake db:migrate

In Ruby on Rails, it is very to add new version of database tables or columns. It has built-in support in by using this command:

rake db:migrate

To revert back to the earlier version of database structures, just add VERSION= xxx to the back of the command. It becomes:

rake db:migrate VERSION=20090103162017

(this number "20090103162017" is the version number of the migration files generated by rake db:migrate. It is so simple.

else you can use

rake db:rollback

(this will rollback the last migration)

No comments: