Hi, I've an applicattion actually in production wich i wrote in php last year. Now, I'm working on a new version in Ruby/Rails. So, can someone tell me how can I generate a migration so that every time I run it the "data" from the old db get's copied to the new one?? Note that _I've already the schema, I want something that automatically could copy the field old_id of the table DB1._my_old_table to the field id of DB2.my_table. Thanks.
on 2006-05-21 00:47
on 2006-05-21 01:15
What I did was save a dump of my MySQL database, edit it using a text editor until postgresql stopped complaining, and reloaded it into postgresql. Then I saved the db from postgresql on one machine and tried to restore it to postgresql on another, only to find that version 8.1.3 somehow differed enough from postgresql 8.1.2 so that more hand-editing was necessary. I hope you have better luck. One alternative might be to create an app using SOA to feed one database from another. A nice exercise in rails/ruby programming. Well within it's capabilities. I did use migrations for the schema, though. Warren S.
on 2006-05-21 17:46
Why can't you just dump the data into an SQL file, and then reload it in the second database? Mysql has a "mysqldump" program that can get the dump you need. If you're operating inside the same DB instance, you can actually use SELECT INTO statements to achieve the same effect, but you have to do one statement for each table.