Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion priv/templates/phx.gen.auth/migration.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule <%= inspect schema.repo %>.Migrations.Create<%= Macro.camelize(schema.table) %>AuthTables do
use Ecto.Migration
use <%= inspect schema.migration_module %>

def change do<%= if Enum.any?(migration.extensions) do %><%= for extension <- migration.extensions do %>
<%= extension %><% end %>
Expand Down
23 changes: 23 additions & 0 deletions test/mix/tasks/phx.gen.auth_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,29 @@ defmodule Mix.Tasks.Phx.Gen.AuthTest do
end)
end

test "generates migration with a custom migration module", config do
in_tmp_phx_project(config.test, fn ->
send(self(), {:mix_shell_input, :yes?, false})

try do
Application.put_env(:ecto_sql, :migration_module, MyCustomApp.MigrationModule)

Gen.Auth.run(
~w(Accounts User users --no-compile),
ecto_adapter: Ecto.Adapters.Postgres
)

assert [migration] = Path.wildcard("priv/repo/migrations/*_create_users_auth_tables.exs")

assert_file(migration, fn file ->
assert file =~ "use MyCustomApp.MigrationModule"
end)
after
Application.delete_env(:ecto_sql, :migration_module)
end
end)
end

test "supports --binary-id option", config do
in_tmp_phx_project(config.test, fn ->
send(self(), {:mix_shell_input, :yes?, false})
Expand Down
Loading