File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -140,4 +140,19 @@ def psql(args)
140140 `#{ PSQL_EXE } #{ args } `
141141 end
142142
143+ if ActiveRecord ::VERSION ::STRING . start_with? ( '4.2' ) && JRUBY_VERSION . start_with? ( '1.7' )
144+ warn "NOTE: patching structure_dump due on JRuby #{ JRUBY_VERSION } "
145+ # NOTE: a hack around structure_dump failing due system(cmd, *args) on 1.7 (not going to get fixed)
146+ # RuntimeError: failed to execute:
147+ # pg_dump -s -x -O -f db/structure.sql test_rake_db
148+ require 'active_record/tasks/postgresql_database_tasks.rb'
149+ ActiveRecord ::Tasks ::PostgreSQLDatabaseTasks . module_eval do
150+ def run_cmd ( cmd , args , action )
151+ # fail run_cmd_error(cmd, args, action) unless Kernel.system(cmd, *args)
152+ cmd_full = "#{ cmd } #{ args . map { |arg | Shellwords . escape ( arg ) } . join ( ' ' ) } "
153+ fail run_cmd_error ( cmd , args , action ) unless Kernel . system ( cmd_full )
154+ end
155+ end
156+ end
157+
143158end
You can’t perform that action at this time.
0 commit comments