@@ -56,9 +56,10 @@ defmodule Mix.Tasks.Ecto.Load do
56
56
"""
57
57
58
58
@ impl true
59
- def run ( args , table_exists? \\ & Ecto.Adapters.SQL . table_exists? / 2 ) do
59
+ def run ( args , table_exists? \\ & Ecto.Adapters.SQL . table_exists? / 3 ) do
60
60
{ opts , _ } = OptionParser . parse! ( args , strict: @ switches , aliases: @ aliases )
61
61
opts = Keyword . merge ( @ default_opts , opts )
62
+ opts = if opts [ :quiet ] , do: Keyword . put ( opts , :log , false ) , else: opts
62
63
63
64
Enum . each ( parse_repo ( args ) , fn repo ->
64
65
ensure_repo ( repo , args )
@@ -70,7 +71,7 @@ defmodule Mix.Tasks.Ecto.Load do
70
71
)
71
72
72
73
{ migration_repo , source } = Ecto.Migration.SchemaMigration . get_repo_and_source ( repo , repo . config ( ) )
73
- { :ok , loaded? , _ } = Ecto.Migrator . with_repo ( migration_repo , & table_exists? . ( & 1 , source ) )
74
+ { :ok , loaded? , _ } = Ecto.Migrator . with_repo ( migration_repo , table_exists_closure ( table_exists? , source , opts ) )
74
75
75
76
for repo <- Enum . uniq ( [ repo , migration_repo ] ) do
76
77
cond do
@@ -87,6 +88,14 @@ defmodule Mix.Tasks.Ecto.Load do
87
88
end )
88
89
end
89
90
91
+ defp table_exists_closure ( fun , source , opts ) when is_function ( fun , 3 ) do
92
+ & fun . ( & 1 , source , opts )
93
+ end
94
+
95
+ defp table_exists_closure ( fun , source , _opts ) when is_function ( fun , 2 ) do
96
+ & fun . ( & 1 , source )
97
+ end
98
+
90
99
defp skip_safety_warnings? do
91
100
Mix.Project . config ( ) [ :start_permanent ] != true
92
101
end
0 commit comments