lib/tasks/pg_pull.rake in effective_developer-0.6.9 vs lib/tasks/pg_pull.rake in effective_developer-0.6.10
- old
+ new
@@ -187,15 +187,14 @@
end
desc 'Clones the production (--remote heroku by default) database to staging (--remote staging by default)'
task :clone, [:source_remote, :target_remote] => :environment do |t, args|
args.with_defaults(:source_remote => 'heroku', :target_remote => 'staging')
- db = ActiveRecord::Base.configurations[Rails.env]
puts "=== Cloning remote '#{args.source_remote}' to '#{args.target_remote}'"
- Bundler.with_clean_env do
+ Bundler.with_unbundled_env do
unless system("heroku pg:backups:capture --remote #{args.source_remote}")
abort "Error capturing heroku backup"
end
url = (`heroku pg:backups:public-url --remote #{args.source_remote}`).chomp
@@ -238,10 +237,10 @@
abort('Aborted') unless STDIN.gets.chomp.downcase == 'y'
puts "=== Cloning local table '#{args.table}' to remote #{args.remote} database"
# Dump my local database table
- db = ActiveRecord::Base.configurations[Rails.env]
+ db = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first
tmpfile = "tmp/#{args.table}.sql"
unless system("pg_dump --data-only --table=#{args.table} -h localhost -U '#{db['username']}' '#{db['database']}' > #{tmpfile}")
abort "Error dumping local database table"
end