magic_hat wrote:
> 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.

Did you look at this plugin?

http://agilewebdevelopment.com/plugins/manage_fixtures

  [%] rake db:fixtures:export_all RAILS_ENV=development
  [%] rake db:fixtures:load

When loading specify your new database, RAILS_ENV=new_development or 
other.

Stephan

> 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.

-- 
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@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