Skip to content

Commit

Permalink
Ensure module is loaded before checking for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Aug 21, 2023
1 parent bd95cbf commit 3888004
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/ecto/migrator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,7 @@ defmodule Ecto.Migrator do
end

defp attempt(repo, config, version, module, direction, operation, reference, opts) do
if Code.ensure_loaded?(module) and
function_exported?(module, operation, 0) do
if Code.ensure_loaded?(module) and function_exported?(module, operation, 0) do
Runner.run(repo, config, version, module, direction, operation, reference, opts)
:ok
end
Expand Down Expand Up @@ -702,7 +701,7 @@ defmodule Ecto.Migrator do
end

defp migration?(mod) do
function_exported?(mod, :__migration__, 0)
Code.ensure_loaded?(mod) and function_exported?(mod, :__migration__, 0)
end

defp migrate([], direction, _repo, opts) do
Expand Down

0 comments on commit 3888004

Please sign in to comment.