Migrate back to the most current version: Version 3.
Figure 33. (Click to enlarge.)
And our schema is reconstructed.
Figure 34. (Click to enlarge.)
As is our database.
Figure 35. (Click to enlarge.)
Paul: OK. So the first thought I'm getting is that, with migrations, I can pretty easily put my database under version control. So if I've got a customer-reported bug to fix and the database schema has changed since the release they're using, I can migrate my development and test systems' databases back to the version that matches the software they're running. And if there are intervening releases, I can step through the whole list doing exactly the same thing. So basically, I can check out my database right along with my code base. I have to admit, that is pretty cool.
So what do we have to do now? I mean, we've got some garbage in our migrations now. We have no idea whether or not Boss is going to want to add any information about contributors. Can we get rid of those migration files?
CB: We can, but we need to do it carefully. Rails won't like it if we get things out of synch. The easiest way to get everything back to where we started is to use Rails to migrate us back to our baseline,
Figure 36. (Click to enlarge.)
check our schema to make sure it's what we expect,
Figure 37. (Click to enlarge.)
check our database to make sure it's what we expect,
Figure 38. (Click to enlarge.)
then go to the migration directory,
and get rid of the garbage.
Now our migrations will start again with the current version being our baseline.
Figure 41. (Click to enlarge.)
All cleaned up and ready to move forward.
Paul: Wow. That's pretty impressive stuff! I'll have to play around with it some more. Right now, though, I've got to take off. Thanks for sharing the pie and for taking me through migrations. If we can, I'd like to pick up next time we get together with the unit tests. I'll definitely feel better when I know those are in place.
And so Paul takes off and CB goes back to his 9-5 drudgery, daydreaming just a little about what the future might hold. Could it really happen? Could this actually turn into a chance to do some serious coding in Ruby on Rails? Have some fun and get paid too? Well now, there's something I'd like a lot! Even better if it comes with free pizza! ;-)
Click to continue your adventure as CB and Paul add Unit tests to their Cookbook app.
Bill Walton is a software development/project management consultant/contractor.
Return to Ruby.
2008-01-16 06:34:40 lrt [View]
One more time:Thanks!
2007-12-20 10:37:06 pakosis [View]
Thank you all
2007-09-13 20:45:57 Staramor [View]
Migration Error on Linux
2007-07-10 11:41:25 waylonflinn [View]
Migration Error on Linux
2007-07-11 06:36:36 Bill Walton | [View]
2007-05-24 11:06:31 randyh [View]
2007-05-23 09:07:15 jon_austin [View]
2007-05-21 20:22:22 asommer [View]
2007-05-17 12:20:27 perrin [View]
2007-05-24 06:48:57 Bill Walton | [View]
2007-06-13 00:32:05 xeal [View]