From 2001cdea567466330a70efe168f8de2629fc4747 Mon Sep 17 00:00:00 2001 From: rmand97 <102654833+rmand97@users.noreply.github.com> Date: Thu, 20 Feb 2025 17:14:54 +0100 Subject: [PATCH] align sqlite migration code with comment (#6101) * align code with comment * fix tests --- installer/templates/phx_single/lib/app_name/application.ex | 2 +- .../phx_umbrella/apps/app_name/lib/app_name/application.ex | 2 +- installer/test/phx_new_test.exs | 2 +- installer/test/phx_new_umbrella_test.exs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/installer/templates/phx_single/lib/app_name/application.ex b/installer/templates/phx_single/lib/app_name/application.ex index 65aad283e9..e195ff6a45 100644 --- a/installer/templates/phx_single/lib/app_name/application.ex +++ b/installer/templates/phx_single/lib/app_name/application.ex @@ -37,6 +37,6 @@ defmodule <%= @app_module %>.Application do defp skip_migrations?() do # By default, sqlite migrations are run when using a release - System.get_env("RELEASE_NAME") != nil + System.get_env("RELEASE_NAME") == nil end<% end %> end diff --git a/installer/templates/phx_umbrella/apps/app_name/lib/app_name/application.ex b/installer/templates/phx_umbrella/apps/app_name/lib/app_name/application.ex index 9043d6b742..d455ad2cbf 100644 --- a/installer/templates/phx_umbrella/apps/app_name/lib/app_name/application.ex +++ b/installer/templates/phx_umbrella/apps/app_name/lib/app_name/application.ex @@ -23,6 +23,6 @@ defmodule <%= @app_module %>.Application do defp skip_migrations?() do # By default, sqlite migrations are run when using a release - System.get_env("RELEASE_NAME") != nil + System.get_env("RELEASE_NAME") == nil end<% end %> end diff --git a/installer/test/phx_new_test.exs b/installer/test/phx_new_test.exs index baaeeb328b..73487e14e7 100644 --- a/installer/test/phx_new_test.exs +++ b/installer/test/phx_new_test.exs @@ -704,7 +704,7 @@ defmodule Mix.Tasks.Phx.NewTest do assert file =~ "skip: skip_migrations?()" assert file =~ "defp skip_migrations?() do" - assert file =~ ~s/System.get_env("RELEASE_NAME") != nil/ + assert file =~ ~s/System.get_env("RELEASE_NAME") == nil/ end) assert_file("custom_path/test/support/conn_case.ex", "DataCase.setup_sandbox(tags)") diff --git a/installer/test/phx_new_umbrella_test.exs b/installer/test/phx_new_umbrella_test.exs index 31a95ed3a4..1b97c6fdf7 100644 --- a/installer/test/phx_new_umbrella_test.exs +++ b/installer/test/phx_new_umbrella_test.exs @@ -635,7 +635,7 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do assert file =~ "skip: skip_migrations?()" assert file =~ "defp skip_migrations?() do" - assert file =~ ~s/System.get_env("RELEASE_NAME") != nil/ + assert file =~ ~s/System.get_env("RELEASE_NAME") == nil/ end) assert_file(root_path(app, "config/dev.exs"), [~r/database: .*_dev.db/])