This post originated from an RSS feed registered with Ruby Buzz
by Eric Stewart.
Original Post: Migrating Old DBs with Migrations
Feed Title: Ponderings On Ruby
Feed URL: http://blog.eric-stewart.com/category/programming-ruby.rss
Feed Description: This is the Ruby related section of Eric Stewart's weblog. These entries will be the commentary of a long time Java/C++ programmer that started exploring Ruby in 2003.
One of the big advantages of Rails and ActiveRecord in particular is the ease of maintenance and small code size when you follow the conventions that ActiveRecord expects.
Over the past 6 months I have read several accounts of people wanting to adapt an existing web application to Rails, preferably preserving the database. A common pain expressed is that you lose many of the benefits of ActiveRecord if you have to configure your application to understand a datase that doesn’t follow the conventions it prefers.
ActiveRecord now has Migrations, which are intended to version and adapt an existing database as your application changes, typicall through development/deployment cycles. But what if we use migrations to adapt the database from another application that we are rewriting in Rails?
Right now it seems very practical if you document the exact version of database from the original application. Because you won’t have ActiveRecord model classes for the original database there will be some direct SQL required in most cases. That might leave you with a nice upgrade path from the original application as well (at least one particular version of it).
My current project hasn’t taken advantage of migrations yet but will soon (more on that later). It is a new project with a new database however.
I have an itch to try porting at least one open source application I use to Rails for my own convenience. Maybe I’ll give this a try. Has anyone done this yet?