File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -416,16 +416,22 @@ defmodule Ecto.Adapters.MyXQL do
416416 def structure_load ( default , config ) do
417417 path = config [ :dump_path ] || Path . join ( default , "structure.sql" )
418418
419- args = [
420- "--execute" ,
421- "SET FOREIGN_KEY_CHECKS = 0; SOURCE #{ path } ; SET FOREIGN_KEY_CHECKS = 1" ,
422- "--database" ,
423- config [ :database ]
424- ]
425-
426- case run_with_cmd ( "mysql" , config , args ) do
427- { _output , 0 } -> { :ok , path }
428- { output , _ } -> { :error , output }
419+ case File . read ( path ) do
420+ { :ok , contents } ->
421+ args = [
422+ "--execute" ,
423+ "SET FOREIGN_KEY_CHECKS = 0; " <> contents <> "; SET FOREIGN_KEY_CHECKS = 1" ,
424+ "--database" ,
425+ config [ :database ]
426+ ]
427+
428+ case run_with_cmd ( "mysql" , config , args ) do
429+ { _output , 0 } -> { :ok , path }
430+ { output , _ } -> { :error , output }
431+ end
432+
433+ { :error , reason } ->
434+ { :error , "could not read #{ inspect ( path ) } : #{ :file . format_error ( reason ) } " }
429435 end
430436 end
431437
You can’t perform that action at this time.
0 commit comments