I have several (old) Drupal-sites that need to be replaced with one single new Rails app. That new site should hold all old Drupal-content. That old Drupal-content is partly broken (due to nearly 7 years of fugly upgrades, discontinued modules and so on). The fact that it is Drupal is hardly relevant, just the fact that it causes some inconsistencies, weird naming, and badly normalised tables.
The content needing to be imported into the Rails app is simple: content (blog-entries), attached files (images) and comments. I have the luxury of two databases being "stale" (not in production) and two more being in production, but allowed to go down/locked for a while (hours, days). So, the migrations need not be optimized for speed, or be entirely save (meaning: I can afford to loose a comment being posted while running the migration)
The Rails(3) app is mostly done, and using Active-record conventions only.
Due to the contraints (broken, inconsistent database, several databases needing merging) I prefer to write migrations for this, instead of connecting my new Rails app to an ugly, inconsistent legacy databse.
My questions are:
- Are there any environments, gems or tools that make importing in Rails easier: e.g. something that allows simple mapping from old-new in some DSL.
- Or is it easier to write my migrations entirely in SQL: SQL queries that will turn the old data into the structure that fits the Rails app? Migrating is from MySQL->MySQL.
- Or should I just connect Activerecord to the old databases, loop over each row/result and run an Object.save! in my rails app?