I just want to roll one version back, But I don't know the current VERSION, Is there a command to check it?
-
sorry dude, I was too excited to try each solution out, and forget came back to accept answermko– mko2010-12-10 15:35:18 +00:00Commented Dec 10, 2010 at 15:35
-
no problem ^^ I was just wondering if I had to add anything to my answermarcgg– marcgg2010-12-10 17:15:06 +00:00Commented Dec 10, 2010 at 17:15
-
how to add @yozloy in the front of your comment, it's a quote function or what?mko– mko2010-12-11 04:45:43 +00:00Commented Dec 11, 2010 at 4:45
3 Answers
First, it's worth taking the time to read the Rails Guide regarding migrations. Then regarding your specific question:
... to roll back one version:
rake db:rollback STEP=1
... to see the current version:
rake db:version
Comments
VERSION essentially is the name of a specific migration and not a point in time. You need to roll back multiple such “versions” to get back in time. These versions have the same names as the file names in db/migrate (without extension). This can be used to roll back a specific migration without undoing migrations done later.
Use the STEP parameter to go back in time a specified amount of migration steps.
Comments
Migrations are timestamped. It is safe to assume that the latest timestamp is the current migration in most instances.