> Hey all. I'm trying to export my app's data from mysql to postgres in
> advance of a database switch.
>
> I've tried this:
>
>   task(:export => :environment) do
>     @users=User.find(:all)
>     ActiveRecord::Base.establish_connection(:pg)
>     for user in @users
>       user.save_with_validation(perform_validation = false)
>     end
>     ActiveRecord::Base.establish_connection(:development)
>   end
>
> However, nothing's happening -- no activity in the pg environment log,
> no records added.
>
> I've also tried exporting as yaml and then importing, using Tobias
> Lutke's approach (http://blog.leetsoft.com/files/code/backup.rake)
>
> However, the import bombs here:
>         myFile=YAML.load_file("#{tbl}.yml")
>  because of some unexpected quote marks in some of the content.
>
> Any help getting either of these approaches to work would be hugely
> appreciated.

Taps (http://adam.blog.heroku.com/past/2009/2/11/
taps_for_easy_database_transfers/) is an excellent solution for this.
Heroku use it for cross-db support. Note that it works over network
connections, which is very handy.
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to