-
-
Save shunchu/3070392 to your computer and use it in GitHub Desktop.
Revisions
-
Roy Ratcliffe created this gist
Oct 2, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ namespace :pg do namespace :structure do # Does exactly the same as db:structure:dump but with one important # difference. It tries to use a compatible version of pg_dump. If you see # the following error message, use pg:structure:dump instead. # # pg_dump: server version: 9.1.0; pg_dump version: 9.0.4 # pg_dump: aborting because of server version mismatch # rake aborted! # Error dumping database # # The pg:structure:dump task overrides the PATH before invoking the regular # database structure dump. By default it looks for PostgreSQL 9.1 at # /opt/local/lib/postgresql91 where MacPorts places it. But you can override # this using POSTGRESQL_PATH on the rake command line. desc "Dump the PostgreSQL database structure to an SQL file" task :dump => :environment do path_to_postgresql = ENV['POSTGRESQL_PATH'] || '/opt/local/lib/postgresql91' ENV['PATH'] = File.join(path_to_postgresql, 'bin') + ':' + ENV['PATH'] Rake::Task['db:structure:dump'].invoke end end end