Migrating several legacy databases into one Rails app?

Interesting case, I am facing the same issue on my current project I think you should consider the second point! 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 Write the SQL migrations to import the data from your old database to the new one, then work with the new schema!

I suppose you have a dump SQL file with a list of INSERT queries for each old-database So the strategy for this could be: Create one SQL view for each table of the old database schema, from your new schema Run those INSERT against your views At first, I was going to tell you about the legacy_data gem which basically generates all the model layer with the appropriate validations/associations, but it is useless in your case given that you already have all the necessary models set up in your Rails application.

Interesting case, I am facing the same issue on my current project. I think you should consider the second point! 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. Write the SQL migrations to import the data from your old database to the new one, then work with the new schema! I suppose you have a dump SQL file with a list of INSERT queries for each old-database.So the strategy for this could be: Create one SQL view for each table of the old database schema, from your new schema.

Run those INSERT against your views. At first, I was going to tell you about the legacy_data gem which basically generates all the model layer with the appropriate validations/associations, but it is useless in your case given that you already have all the necessary models set up in your Rails application.

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). 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. 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. In my rails app?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions