Forum: Ruby on Rails Migrate database to a new one using migrations.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C7d5bc5b054035d95f287797c2595694?d=identicon&s=25 Matias Surdi (Guest)
on 2006-05-20 22:47
(Received via mailing list)
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.
E6dd9cedee99f9d02e5f87d80ee0e681?d=identicon&s=25 Warren Seltzer (Guest)
on 2006-05-20 23:15
(Received via mailing list)
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
Fb23bc8cd4030c526b0689276b34c8bd?d=identicon&s=25 Bryan Duxbury (bryanduxbury)
on 2006-05-21 15: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.
This topic is locked and can not be replied to.