@@ -56,9 +56,10 @@ defmodule Mix.Tasks.Ecto.Load do
5656 """
5757
5858 @ 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
6060 { opts , _ } = OptionParser . parse! ( args , strict: @ switches , aliases: @ aliases )
6161 opts = Keyword . merge ( @ default_opts , opts )
62+ opts = if opts [ :quiet ] , do: Keyword . put ( opts , :log , false ) , else: opts
6263
6364 Enum . each ( parse_repo ( args ) , fn repo ->
6465 ensure_repo ( repo , args )
@@ -70,7 +71,7 @@ defmodule Mix.Tasks.Ecto.Load do
7071 )
7172
7273 { 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 ) )
7475
7576 for repo <- Enum . uniq ( [ repo , migration_repo ] ) do
7677 cond do
@@ -87,6 +88,14 @@ defmodule Mix.Tasks.Ecto.Load do
8788 end )
8889 end
8990
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+
9099 defp skip_safety_warnings? do
91100 Mix.Project . config ( ) [ :start_permanent ] != true
92101 end
0 commit comments