From e25a7ce19f7a2ef3128843aaa8d694b03cb25cb0 Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Sat, 22 Jul 2023 22:24:30 -0400 Subject: [PATCH] format lib/ecto/*.ex --- lib/ecto/migration.ex | 180 +++++++++++++++++++++++++++--------------- lib/ecto/migrator.ex | 117 +++++++++++++++------------ 2 files changed, 184 insertions(+), 113 deletions(-) diff --git a/lib/ecto/migration.ex b/lib/ecto/migration.ex index b7baeeb1..cfa50398 100644 --- a/lib/ecto/migration.ex +++ b/lib/ecto/migration.ex @@ -389,20 +389,20 @@ defmodule Ecto.Migration do options: nil @type t :: %__MODULE__{ - table: String.t, - prefix: atom, - name: atom, - columns: [atom | String.t], - unique: boolean, - concurrently: boolean, - using: atom | String.t, - only: boolean, - include: [atom | String.t], - nulls_distinct: boolean | nil, - where: atom | String.t, - comment: String.t | nil, - options: String.t - } + table: String.t(), + prefix: atom, + name: atom, + columns: [atom | String.t()], + unique: boolean, + concurrently: boolean, + using: atom | String.t(), + only: boolean, + include: [atom | String.t()], + nulls_distinct: boolean | nil, + where: atom | String.t(), + comment: String.t() | nil, + options: String.t() + } end defmodule Table do @@ -412,8 +412,15 @@ defmodule Ecto.Migration do To define a table in a migration, see `Ecto.Migration.table/2`. """ defstruct name: nil, prefix: nil, comment: nil, primary_key: true, engine: nil, options: nil - @type t :: %__MODULE__{name: String.t, prefix: atom | nil, comment: String.t | nil, primary_key: boolean | keyword(), - engine: atom, options: String.t} + + @type t :: %__MODULE__{ + name: String.t(), + prefix: atom | nil, + comment: String.t() | nil, + primary_key: boolean | keyword(), + engine: atom, + options: String.t() + } end defmodule Reference do @@ -422,12 +429,28 @@ defmodule Ecto.Migration do To define a reference in a migration, see `Ecto.Migration.references/2`. """ - defstruct name: nil, prefix: nil, table: nil, column: :id, type: :bigserial, - on_delete: :nothing, on_update: :nothing, validate: true, - with: [], match: nil - @type t :: %__MODULE__{table: String.t, prefix: atom | nil, column: atom, type: atom, - on_delete: atom, on_update: atom, validate: boolean, - with: list, match: atom | nil} + defstruct name: nil, + prefix: nil, + table: nil, + column: :id, + type: :bigserial, + on_delete: :nothing, + on_update: :nothing, + validate: true, + with: [], + match: nil + + @type t :: %__MODULE__{ + table: String.t(), + prefix: atom | nil, + column: atom, + type: atom, + on_delete: atom, + on_update: atom, + validate: boolean, + with: list, + match: atom | nil + } end defmodule Constraint do @@ -436,9 +459,23 @@ defmodule Ecto.Migration do To define a constraint in a migration, see `Ecto.Migration.constraint/3`. """ - defstruct name: nil, table: nil, check: nil, exclude: nil, prefix: nil, comment: nil, validate: true - @type t :: %__MODULE__{name: atom, table: String.t, prefix: atom | nil, - check: String.t | nil, exclude: String.t | nil, comment: String.t | nil, validate: boolean} + defstruct name: nil, + table: nil, + check: nil, + exclude: nil, + prefix: nil, + comment: nil, + validate: true + + @type t :: %__MODULE__{ + name: atom, + table: String.t(), + prefix: atom | nil, + check: String.t() | nil, + exclude: String.t() | nil, + comment: String.t() | nil, + validate: boolean + } end defmodule Command do @@ -451,7 +488,7 @@ defmodule Ecto.Migration do To define a reversible command in a migration, see `Ecto.Migration.execute/2`. """ defstruct up: nil, down: nil - @type t :: %__MODULE__{up: String.t, down: String.t} + @type t :: %__MODULE__{up: String.t(), down: String.t()} end alias Ecto.Migration.Runner @@ -564,17 +601,17 @@ defmodule Ecto.Migration do """ def create(%Index{} = index) do - Runner.execute {:create, __prefix__(index)} + Runner.execute({:create, __prefix__(index)}) index end def create(%Constraint{} = constraint) do - Runner.execute {:create, __prefix__(constraint)} + Runner.execute({:create, __prefix__(constraint)}) constraint end def create(%Table{} = table) do - do_create table, :create + do_create(table, :create) table end @@ -589,11 +626,11 @@ defmodule Ecto.Migration do """ def create_if_not_exists(%Index{} = index) do - Runner.execute {:create_if_not_exists, __prefix__(index)} + Runner.execute({:create_if_not_exists, __prefix__(index)}) end def create_if_not_exists(%Table{} = table) do - do_create table, :create_if_not_exists + do_create(table, :create_if_not_exists) end defp do_create(table, command) do @@ -605,7 +642,7 @@ defmodule Ecto.Migration do [] end - Runner.execute {command, __prefix__(table), columns} + Runner.execute({command, __prefix__(table), columns}) end @doc """ @@ -631,7 +668,10 @@ defmodule Ecto.Migration do """ def drop(%{} = index_or_table_or_constraint, opts \\ []) when is_list(opts) do - Runner.execute {:drop, __prefix__(index_or_table_or_constraint), Keyword.get(opts, :mode, :restrict)} + Runner.execute( + {:drop, __prefix__(index_or_table_or_constraint), Keyword.get(opts, :mode, :restrict)} + ) + index_or_table_or_constraint end @@ -655,7 +695,9 @@ defmodule Ecto.Migration do """ def drop_if_exists(%{} = index_or_table, opts \\ []) when is_list(opts) do - Runner.execute {:drop_if_exists, __prefix__(index_or_table), Keyword.get(opts, :mode, :restrict)} + Runner.execute( + {:drop_if_exists, __prefix__(index_or_table), Keyword.get(opts, :mode, :restrict)} + ) index_or_table end @@ -885,12 +927,12 @@ defmodule Ecto.Migration do defp default_index_name(index) do [index.table, index.columns, "index"] - |> List.flatten + |> List.flatten() |> Enum.map(&to_string(&1)) |> Enum.map(&String.replace(&1, ~r"[^\w_]", "_")) |> Enum.map(&String.replace_trailing(&1, "_", "")) |> Enum.join("_") - |> String.to_atom + |> String.to_atom() end @doc """ @@ -916,7 +958,7 @@ defmodule Ecto.Migration do execute(fn -> repo().update_all("posts", set: [published: true]) end) """ def execute(command) when is_binary(command) or is_function(command, 0) or is_list(command) do - Runner.execute command + Runner.execute(command) end @doc """ @@ -944,9 +986,10 @@ defmodule Ecto.Migration do defp execute_down, do: repo().query!("select 'Down query …';", [], [log: :info]) end """ - def execute(up, down) when (is_binary(up) or is_function(up, 0) or is_list(up)) and - (is_binary(down) or is_function(down, 0) or is_list(down)) do - Runner.execute %Command{up: up, down: down} + def execute(up, down) + when (is_binary(up) or is_function(up, 0) or is_list(up)) and + (is_binary(down) or is_function(down, 0) or is_list(down)) do + Runner.execute(%Command{up: up, down: down}) end @doc """ @@ -958,7 +1001,7 @@ defmodule Ecto.Migration do """ def execute_file(path) when is_binary(path) do command = File.read!(path) - Runner.execute command + Runner.execute(command) end @doc """ @@ -971,7 +1014,7 @@ defmodule Ecto.Migration do def execute_file(up_path, down_path) when is_binary(up_path) and is_binary(down_path) do up = File.read!(up_path) down = File.read!(down_path) - Runner.execute %Command{up: up, down: down} + Runner.execute(%Command{up: up, down: down}) end @doc """ @@ -985,7 +1028,7 @@ defmodule Ecto.Migration do @doc """ Gets the migrator repo. """ - @spec repo :: Ecto.Repo.t + @spec repo :: Ecto.Repo.t() def repo do Runner.repo() end @@ -1064,7 +1107,7 @@ defmodule Ecto.Migration do def add(column, type, opts \\ []) when is_atom(column) and is_list(opts) do validate_precision_opts!(opts, column) validate_type!(type) - Runner.subcommand {:add, column, type, opts} + Runner.subcommand({:add, column, type, opts}) end @doc """ @@ -1086,7 +1129,7 @@ defmodule Ecto.Migration do def add_if_not_exists(column, type, opts \\ []) when is_atom(column) and is_list(opts) do validate_precision_opts!(opts, column) validate_type!(type) - Runner.subcommand {:add_if_not_exists, column, type, opts} + Runner.subcommand({:add_if_not_exists, column, type, opts}) end @doc """ @@ -1101,7 +1144,7 @@ defmodule Ecto.Migration do rename(index(:people, [:name], name: "persons_name_index"), to: "people_name_index") """ def rename(%Table{} = table_current, to: %Table{} = table_new) do - Runner.execute {:rename, __prefix__(table_current), __prefix__(table_new)} + Runner.execute({:rename, __prefix__(table_current), __prefix__(table_new)}) table_new end @@ -1119,8 +1162,9 @@ defmodule Ecto.Migration do rename table("posts"), :title, to: :summary """ - def rename(%Table{} = table, current_column, to: new_column) when is_atom(current_column) and is_atom(new_column) do - Runner.execute {:rename, __prefix__(table), current_column, new_column} + def rename(%Table{} = table, current_column, to: new_column) + when is_atom(current_column) and is_atom(new_column) do + Runner.execute({:rename, __prefix__(table), current_column, new_column}) table end @@ -1230,7 +1274,7 @@ defmodule Ecto.Migration do def modify(column, type, opts \\ []) when is_atom(column) and is_list(opts) do validate_precision_opts!(opts, column) validate_type!(type) - Runner.subcommand {:modify, column, type, opts} + Runner.subcommand({:modify, column, type, opts}) end @doc """ @@ -1247,7 +1291,7 @@ defmodule Ecto.Migration do """ def remove(column) when is_atom(column) do - Runner.subcommand {:remove, column} + Runner.subcommand({:remove, column}) end @doc """ @@ -1267,7 +1311,7 @@ defmodule Ecto.Migration do """ def remove(column, type, opts \\ []) when is_atom(column) do validate_type!(type) - Runner.subcommand {:remove, column, type, opts} + Runner.subcommand({:remove, column, type, opts}) end @doc """ @@ -1285,7 +1329,7 @@ defmodule Ecto.Migration do """ def remove_if_exists(column, type) when is_atom(column) do validate_type!(type) - Runner.subcommand {:remove_if_exists, column, type} + Runner.subcommand({:remove_if_exists, column, type}) end @doc ~S""" @@ -1359,13 +1403,13 @@ defmodule Ecto.Migration do end defp check_on_delete!(on_delete) - when on_delete in [:nothing, :delete_all, :nilify_all, :restrict], - do: :ok + when on_delete in [:nothing, :delete_all, :nilify_all, :restrict], + do: :ok defp check_on_delete!({:nilify, columns}) when is_list(columns) do unless Enum.all?(columns, &is_atom/1) do raise ArgumentError, - "expected `columns` in `{:nilify, columns}` to be a list of atoms, got: #{inspect columns}" + "expected `columns` in `{:nilify, columns}` to be a list of atoms, got: #{inspect(columns)}" end :ok @@ -1376,8 +1420,8 @@ defmodule Ecto.Migration do end defp check_on_update!(on_update) - when on_update in [:nothing, :update_all, :nilify_all, :restrict], - do: :ok + when on_update in [:nothing, :update_all, :nilify_all, :restrict], + do: :ok defp check_on_update!(on_update) do raise ArgumentError, "unknown :on_update value: #{inspect(on_update)}" @@ -1427,14 +1471,16 @@ defmodule Ecto.Migration do # Validation helpers defp validate_type!(:datetime) do - raise ArgumentError, "the :datetime type in migrations is not supported, " <> - "please use :utc_datetime or :naive_datetime instead" + raise ArgumentError, + "the :datetime type in migrations is not supported, " <> + "please use :utc_datetime or :naive_datetime instead" end defp validate_type!(type) when is_atom(type) do case Atom.to_string(type) do "Elixir." <> _ -> raise_invalid_migration_type!(type) + _ -> :ok end @@ -1505,18 +1551,22 @@ defmodule Ecto.Migration do is_nil(prefix) -> prefix = runner_prefix || Runner.repo_config(:migration_default_prefix, nil) %{index_or_table | prefix: prefix} + is_nil(runner_prefix) or runner_prefix == to_string(prefix) -> index_or_table + true -> - raise Ecto.MigrationError, message: - "the :prefix option `#{prefix}` does not match the migrator prefix `#{runner_prefix}`" + raise Ecto.MigrationError, + message: + "the :prefix option `#{prefix}` does not match the migrator prefix `#{runner_prefix}`" end end @doc false def __primary_key__(table) do case table.primary_key do - false -> false + false -> + false true -> case Runner.repo_config(:migration_primary_key, []) do @@ -1524,10 +1574,12 @@ defmodule Ecto.Migration do opts when is_list(opts) -> pk_opts_to_tuple(opts) end - opts when is_list(opts) -> pk_opts_to_tuple(opts) + opts when is_list(opts) -> + pk_opts_to_tuple(opts) _ -> - raise ArgumentError, ":primary_key option must be either a boolean or a keyword list of options" + raise ArgumentError, + ":primary_key option must be either a boolean or a keyword list of options" end end diff --git a/lib/ecto/migrator.ex b/lib/ecto/migrator.ex index bd554d7d..0d867bbb 100644 --- a/lib/ecto/migrator.ex +++ b/lib/ecto/migrator.ex @@ -190,10 +190,10 @@ defmodule Ecto.Migrator do migrations directory. This can be used to specify a custom migrations path. """ - @spec migrations_path(Ecto.Repo.t, String.t) :: String.t + @spec migrations_path(Ecto.Repo.t(), String.t()) :: String.t() def migrations_path(repo, directory \\ "migrations") do config = repo.config() - priv = config[:priv] || "priv/#{repo |> Module.split |> List.last |> Macro.underscore}" + priv = config[:priv] || "priv/#{repo |> Module.split() |> List.last() |> Macro.underscore()}" app = Keyword.fetch!(config, :otp_app) Application.app_dir(app, Path.join(priv, directory)) end @@ -215,9 +215,9 @@ defmodule Ecto.Migrator do commands may fail if this is set to true. Defaults to `false`. Accepts a boolean. """ - @spec migrated_versions(Ecto.Repo.t, Keyword.t) :: [integer] + @spec migrated_versions(Ecto.Repo.t(), Keyword.t()) :: [integer] def migrated_versions(repo, opts \\ []) do - lock_for_migrations true, repo, opts, fn _config, versions -> versions end + lock_for_migrations(true, repo, opts, fn _config, versions -> versions end) end @doc """ @@ -242,9 +242,9 @@ defmodule Ecto.Migrator do * `:strict_version_order` - abort when applying a migration with old timestamp (otherwise it emits a warning) """ - @spec up(Ecto.Repo.t, integer, module, Keyword.t) :: :ok | :already_up + @spec up(Ecto.Repo.t(), integer, module, Keyword.t()) :: :ok | :already_up def up(repo, version, module, opts \\ []) do - conditional_lock_for_migrations module, version, repo, opts, fn config, versions -> + conditional_lock_for_migrations(module, version, repo, opts, fn config, versions -> if version in versions do :already_up else @@ -268,21 +268,23 @@ defmodule Ecto.Migrator do if opts[:strict_version_order] do raise Ecto.MigrationError, message else - Logger.warning message + Logger.warning(message) end end result end - end + end) end defp do_up(repo, config, version, module, opts) do async_migrate_maybe_in_transaction(repo, config, version, module, :up, opts, fn -> - attempt(repo, config, version, module, :forward, :up, :up, opts) - || attempt(repo, config, version, module, :forward, :change, :up, opts) - || {:error, Ecto.MigrationError.exception( - "#{inspect module} does not implement a `up/0` or `change/0` function")} + attempt(repo, config, version, module, :forward, :up, :up, opts) || + attempt(repo, config, version, module, :forward, :change, :up, opts) || + {:error, + Ecto.MigrationError.exception( + "#{inspect(module)} does not implement a `up/0` or `change/0` function" + )} end) end @@ -306,23 +308,25 @@ defmodule Ecto.Migrator do See `c:Ecto.Repo.put_dynamic_repo/1`. """ - @spec down(Ecto.Repo.t, integer, module) :: :ok | :already_down + @spec down(Ecto.Repo.t(), integer, module) :: :ok | :already_down def down(repo, version, module, opts \\ []) do - conditional_lock_for_migrations module, version, repo, opts, fn config, versions -> + conditional_lock_for_migrations(module, version, repo, opts, fn config, versions -> if version in versions do do_down(repo, config, version, module, opts) else :already_down end - end + end) end defp do_down(repo, config, version, module, opts) do async_migrate_maybe_in_transaction(repo, config, version, module, :down, opts, fn -> - attempt(repo, config, version, module, :forward, :down, :down, opts) - || attempt(repo, config, version, module, :backward, :change, :down, opts) - || {:error, Ecto.MigrationError.exception( - "#{inspect module} does not implement a `down/0` or `change/0` function")} + attempt(repo, config, version, module, :forward, :down, :down, opts) || + attempt(repo, config, version, module, :backward, :change, :down, opts) || + {:error, + Ecto.MigrationError.exception( + "#{inspect(module)} does not implement a `down/0` or `change/0` function" + )} end) end @@ -347,13 +351,13 @@ defmodule Ecto.Migrator do not repo.__adapter__().supports_ddl_transaction? do fun.() else - {:ok, result} = - repo.transaction(fun, log: migrator_log(opts), timeout: :infinity) + {:ok, result} = repo.transaction(fun, log: migrator_log(opts), timeout: :infinity) result end - catch kind, reason -> - {kind, reason, __STACKTRACE__} + catch + kind, reason -> + {kind, reason, __STACKTRACE__} end defp attempt(repo, config, version, module, direction, operation, reference, opts) do @@ -372,7 +376,7 @@ defmodule Ecto.Migrator do See `run/4` for more information. """ - @spec run(Ecto.Repo.t, atom, Keyword.t) :: [integer] + @spec run(Ecto.Repo.t(), atom, Keyword.t()) :: [integer] def run(repo, direction, opts) do run(repo, [migrations_path(repo)], direction, opts) end @@ -419,25 +423,33 @@ defmodule Ecto.Migrator do Plus all other options described in `up/4`. """ - @spec run(Ecto.Repo.t, String.t | [String.t] | [{integer, module}], atom, Keyword.t) :: [integer] + @spec run(Ecto.Repo.t(), String.t() | [String.t()] | [{integer, module}], atom, Keyword.t()) :: + [integer] def run(repo, migration_source, direction, opts) do migration_source = List.wrap(migration_source) pending = - lock_for_migrations true, repo, opts, fn _config, versions -> + lock_for_migrations(true, repo, opts, fn _config, versions -> cond do opts[:all] -> pending_all(versions, migration_source, direction) + to = opts[:to] -> pending_to(versions, migration_source, direction, to) + to_exclusive = opts[:to_exclusive] -> pending_to_exclusive(versions, migration_source, direction, to_exclusive) + step = opts[:step] -> pending_step(versions, migration_source, direction, step) + true -> - {:error, ArgumentError.exception("expected one of :all, :to, :to_exclusive, or :step strategies")} + {:error, + ArgumentError.exception( + "expected one of :all, :to, :to_exclusive, or :step strategies" + )} end - end + end) # The lock above already created the table, so we can now skip it. opts = Keyword.put(opts, :skip_table_creation, true) @@ -455,7 +467,7 @@ defmodule Ecto.Migrator do Ecto.Migrator.migrations(repo, [Ecto.Migrator.migrations_path(repo)]) """ - @spec migrations(Ecto.Repo.t) :: [{:up | :down, id :: integer(), name :: String.t}] + @spec migrations(Ecto.Repo.t()) :: [{:up | :down, id :: integer(), name :: String.t()}] def migrations(repo) do migrations(repo, [migrations_path(repo)]) end @@ -464,8 +476,8 @@ defmodule Ecto.Migrator do Returns an array of tuples as the migration status of the given repo, without actually running any migrations. """ - @spec migrations(Ecto.Repo.t, String.t | [String.t], Keyword.t) :: - [{:up | :down, id :: integer(), name :: String.t}] + @spec migrations(Ecto.Repo.t(), String.t() | [String.t()], Keyword.t()) :: + [{:up | :down, id :: integer(), name :: String.t()}] def migrations(repo, directories, opts \\ []) do directories = List.wrap(directories) @@ -548,9 +560,9 @@ defmodule Ecto.Migrator do config = repo.config() unless skip_table_creation do - verbose_schema_migration repo, "create schema migrations table", fn -> + verbose_schema_migration(repo, "create schema migrations table", fn -> SchemaMigration.ensure_schema_migrations_table!(repo, config, opts) - end + end) end {migration_repo, query, all_opts} = SchemaMigration.versions(repo, config, opts[:prefix]) @@ -601,24 +613,27 @@ defmodule Ecto.Migrator do within_target_version? = fn {version, _, _}, target, :up -> version <= target + {version, _, _}, target, :down -> version >= target end pending_in_direction(versions, migration_source, direction) - |> Enum.take_while(&(within_target_version?.(&1, target, direction))) + |> Enum.take_while(&within_target_version?.(&1, target, direction)) end - defp pending_to_exclusive(versions, migration_source, direction, target) when is_integer(target) do + defp pending_to_exclusive(versions, migration_source, direction, target) + when is_integer(target) do within_target_version? = fn {version, _, _}, target, :up -> version < target + {version, _, _}, target, :down -> version > target end pending_in_direction(versions, migration_source, direction) - |> Enum.take_while(&(within_target_version?.(&1, target, direction))) + |> Enum.take_while(&within_target_version?.(&1, target, direction)) end defp pending_step(versions, migration_source, direction, count) do @@ -633,14 +648,14 @@ defmodule Ecto.Migrator do defp pending_in_direction(versions, migration_source, :up) do migration_source |> migrations_for() - |> Enum.filter(fn {version, _name, _file} -> not (version in versions) end) + |> Enum.filter(fn {version, _name, _file} -> version not in versions end) end defp pending_in_direction(versions, migration_source, :down) do migration_source |> migrations_for() |> Enum.filter(fn {version, _name, _file} -> version in versions end) - |> Enum.reverse + |> Enum.reverse() end defp migrations_for(migration_source) when is_list(migration_source) do @@ -670,10 +685,12 @@ defmodule Ecto.Migrator do defp ensure_no_duplication!([{version, name, _} | t]) do cond do List.keyfind(t, version, 0) -> - raise Ecto.MigrationError, "migrations can't be executed, migration version #{version} is duplicated" + raise Ecto.MigrationError, + "migrations can't be executed, migration version #{version} is duplicated" List.keyfind(t, name, 1) -> - raise Ecto.MigrationError, "migrations can't be executed, migration name #{name} is duplicated" + raise Ecto.MigrationError, + "migrations can't be executed, migration name #{name} is duplicated" true -> ensure_no_duplication!(t) @@ -696,7 +713,8 @@ defmodule Ecto.Migrator do if mod = Enum.find(loaded_modules, &migration?/1) do {version, mod} else - raise Ecto.MigrationError, "file #{Path.relative_to_cwd(file)} does not define an Ecto.Migration" + raise Ecto.MigrationError, + "file #{Path.relative_to_cwd(file)} does not define an Ecto.Migration" end end @@ -717,19 +735,19 @@ defmodule Ecto.Migrator do end defp do_direction(:up, repo, version, mod, opts) do - conditional_lock_for_migrations mod, version, repo, opts, fn config, versions -> + conditional_lock_for_migrations(mod, version, repo, opts, fn config, versions -> unless version in versions do do_up(repo, config, version, mod, opts) end - end + end) end defp do_direction(:down, repo, version, mod, opts) do - conditional_lock_for_migrations mod, version, repo, opts, fn config, versions -> + conditional_lock_for_migrations(mod, version, repo, opts, fn config, versions -> if version in versions do do_down(repo, config, version, mod, opts) end - end + end) end defp verbose_schema_migration(repo, reason, fun) do @@ -737,7 +755,7 @@ defmodule Ecto.Migrator do fun.() rescue error -> - Logger.error """ + Logger.error(""" Could not #{reason}. This error usually happens due to the following: * The database does not exist @@ -753,19 +771,20 @@ defmodule Ecto.Migrator do configure Ecto to use another table and/or repository for managing migrations: - config #{inspect repo.config[:otp_app]}, #{inspect repo}, + config #{inspect(repo.config[:otp_app])}, #{inspect(repo)}, migration_source: "some_other_table_for_schema_migrations", migration_repo: AnotherRepoForSchemaMigrations The full error report is shown below. - """ + """) + reraise error, __STACKTRACE__ end end defp log(false, _msg), do: :ok defp log(true, msg), do: Logger.info(msg) - defp log(level, msg), do: Logger.log(level, msg) + defp log(level, msg), do: Logger.log(level, msg) defp migrator_log(opts) do Keyword.get(opts, :log_migrator_sql, false)