Matias Surdi
2006-May-20 20:46 UTC
[Rails] Migrate database to a new one using migrations.
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.
Warren Seltzer
2006-May-20 21:12 UTC
[Rails] Migrate database to a new one using migrations.
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 Seltzer -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Matias Surdi Sent: Saturday, May 20, 2006 11:46 PM To: rails@lists.rubyonrails.org Subject: [Rails] Migrate database to a new one using migrations.
Bryan Duxbury
2006-May-21 13:47 UTC
[Rails] Re: Migrate database to a new one using migrations.
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. -- Posted via http://www.ruby-forum.com/.