I'm migrating a PHP app to Rails. The new app has a significantly different schema.
Anybody have experience data from one schema to another? Right now, I'm looking at dumping CSV files and writing Ruby scripts to handle the insertion on the other side. I've also considered using Navicat to export/import to a temp database with the new schema (if it's simple enough), then dump the database and insert the values into a new database using db:seed.
I figure this is gonna be a total pain whichever way I go -- just hoping to minimize the angst. T开发者_StackOverflowhanks in advance!
UPDATE:
Decided to export from Navicat into XML, then use Nokogiri to create seed files for Seed_fu.
Check out Dr. Nic's Magic Model Gem. http://magicmodels.rubyforge.org/dr_nic_magic_models/
Then use rake tasks to iterate through your CSVs and insert using the newly generated models.
精彩评论