Hey all. Seems I’ve found a bug in Rails db:migrate - maybe it is,
maybe it isn’t. If possible - I’d appreciate some help recovering from
it.
Apps, OS, etc.:
MySQL: Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using
readline 5.1
Rails: 2.3.8,
OS: CentOS 5.4 updated as of this past weekend
Long story made short. I have a rails app in development mode with a
significant amount of data. I created a couple migrations to add a
couple columns and remove a couple more. After my first attempt to run
the migrations, I realized I’d made a mistake and attempted to revert my
changes with a ‘rake db:migrate VERSION=""’.
Mistake #1: Oops. I typed the name of my migration incorrectly, and it
reverted to… wait for it… VERSION=“0”. That’s the “bug” part - (I
don’t think) it shouldn’t be reverting to VERSION=“0” whenever it has an
error or fails to find a migration… No, I didn’t have an environment
variable VERSION=“0”.
Mistake #2: My bad - I didn’t back up the database before applying my
changes. 05:30 AM + “meh - simple column change, what could happen…”
=~ poop.onstick()
log/development.log seems like it contains all the INSERT INTO actions.
(crosses fingers) Has anyone ever used the log file to recreate the
database…? Am I missing something: is there a better way?
Any help, input, or ideas beyond “you should have backed up your DB”
would really be appreciated.
Thanks,
Andrew V.
1 403 667 3201 ©
1 403 648 0627 (w)