Skip to content

Commit 042938b

Browse files
committed
chore: credo
1 parent bd833d2 commit 042938b

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

lib/multitenancy.ex

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ defmodule AshPostgres.MultiTenancy do
5252
|> Enum.map(fn {_version, mod, _file} -> mod end)
5353

5454
if Enum.any?(modules_requiring_no_transaction) do
55-
module_list =
56-
modules_requiring_no_transaction
57-
|> Enum.map(&inspect/1)
58-
|> Enum.join(", ")
55+
module_list = Enum.map_join(modules_requiring_no_transaction, ", ", &inspect/1)
5956

6057
Logger.warning("""
6158
Tenant migrations use @disable_ddl_transaction (e.g. CREATE INDEX CONCURRENTLY) but are \
@@ -104,11 +101,13 @@ defmodule AshPostgres.MultiTenancy do
104101
defp load_migration_with_file!({version, _, file}) when is_binary(file) do
105102
loaded_modules = file |> compile_file() |> Enum.map(&elem(&1, 0))
106103

107-
if mod = Enum.find(loaded_modules, &migration?/1) do
108-
{version, mod, file}
109-
else
110-
raise Ecto.MigrationError,
111-
"file #{Path.relative_to_cwd(file)} does not define an Ecto.Migration"
104+
case Enum.find(loaded_modules, &migration?/1) do
105+
nil ->
106+
raise Ecto.MigrationError,
107+
"file #{Path.relative_to_cwd(file)} does not define an Ecto.Migration"
108+
109+
mod ->
110+
{version, mod, file}
112111
end
113112
end
114113

0 commit comments

Comments
 (0)