Created
March 10, 2014 08:52
-
-
Save avsej/9461592 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git i/lib/tasks/db.rake w/lib/tasks/db.rake | |
| index a893c6c..0140f34 100644 | |
| --- i/lib/tasks/db.rake | |
| +++ w/lib/tasks/db.rake | |
| @@ -1,10 +1,10 @@ | |
| namespace :db do | |
| desc "Dump data from PostgreSQL database" | |
| task dump: :environment do | |
| - config = YAML::load_file(Rails.root.join("config", "database.yml"))[Rails.env] | |
| + config = ActiveRecord::Base.configurations[Rails.env] | |
| db_name = config['database'] | |
| uname = config['username'] | |
| - host = config['host'] | |
| + host = config['host'] || config['socket'] | |
| out = Rails.root.join "tmp", "dump.sql" | |
| sh = "`which pg_dump` -U#{uname} -w #{db_name} -h #{host} > #{out}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment