What would be potential strategies to getting the old data into a new db structure? 开发者_运维百科One strategy we are thinking of is to write some ruby which executes some sql on a per table basis.
Since this is a one time task(I am preconceiving things here), you might want to have two databases, one old and one created new, from fresh migration. And write a ruby script to copy data as you want from old to new database.
It will help retain the old database and hence the downtime associated with creating new db and reimporting data from dump. You can use your old code until data is migrated and as soon as data migration to new db completes, update the code and restart the server. Voila! whole lot of data migration with no down time! :)
To summarize what I am suggesting:
- Keep the old database around, don't recreate and reimport to it
- Craete a new databse from fresh migration
- create and run the ruby script to copy data from old database to new one
- update the application code, which works with new databse
- restart the server for new database to kick in
精彩评论