Julien Genestoux
2008-Jul-24 16:46 UTC
Transfer the database from a RoR project to another one
Hi, I am currently working on a version 2 of an existing RoR. Actually, the first version was so bad that we had to rewrite almost everyhting, including many models. Nevertheless, we now need to "migrate" the data from the first application to the second one. Do you have any strategy for this? Should we just "export" the database of the first app and load in the second app... knowing that there is a risk that some of the data we export doesn''t respect the constraints in the second app? is it "smart" to export JSON or XML from the first app (through ActiveRecord) and then re-import everything in the second app through ActiveRecord? If so, how to do that when the tables are pretty big (several hundred thousands of records in some tables...) Thanks for your replies! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There''s a plugin called YamlDB (http://opensource.heroku.com) which can serialize the entire contents of the database into a .yml file. However, if your database has large tables, this solution might not be the best, as the resulting yaml file could be extremely large. Otherwise, your best bet might be the traditional means of dumping and loading SQL (mysqldump, etc.). On Jul 24, 11:46 am, Julien Genestoux <rails-mailing-l...@andreas- s.net> wrote:> Hi, > > I am currently working on a version 2 of an existing RoR. > Actually, the first version was so bad that we had to rewrite almost > everyhting, including many models. Nevertheless, we now need to > "migrate" the data from the first application to the second one. > > Do you have any strategy for this? Should we just "export" the database > of the first app and load in the second app... knowing that there is a > risk that some of the data we export doesn''t respect the constraints in > the second app? > > is it "smart" to export JSON or XML from the first app (through > ActiveRecord) and then re-import everything in the second app through > ActiveRecord? If so, how to do that when the tables are pretty big > (several hundred thousands of records in some tables...) > > Thanks for your replies! > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---