Skip to content

Commit 992378d

Browse files
authored
Merge pull request #736 from pow-auth/test-with-elixir-1-18
Test with Elixir 1.18
2 parents 45a3c65 + cfa8950 commit 992378d

File tree

14 files changed

+73
-57
lines changed

14 files changed

+73
-57
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
- uses: actions/checkout@v3
1717
- uses: erlef/setup-beam@v1
1818
with:
19-
otp-version: 26.0
20-
elixir-version: 1.16
19+
otp-version: 27.0
20+
elixir-version: 1.18
2121
- run: mix deps.get
2222
- run: mix compile --warnings-as-errors
2323
- run: mix credo --ignore design.tagtodo
@@ -40,11 +40,11 @@ jobs:
4040
strategy:
4141
matrix:
4242
version:
43-
- otp: 26.0
44-
elixir: 1.16.0
43+
- otp: 27.0
44+
elixir: 1.18
4545
os: ubuntu-latest
46-
- otp: 22.0
47-
elixir: 1.12.0
46+
- otp: 24.0
47+
elixir: 1.14
4848
# It's necessary to run on ubunto 20.04 for OTP 20 - 25
4949
# See https://github.com/erlef/setup-beam
5050
os: ubuntu-20.04

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v2
2020
- uses: erlef/setup-beam@v1
2121
with:
22-
otp-version: 26.0
23-
elixir-version: 1.16
22+
otp-version: 27.0
23+
elixir-version: 1.18
2424
- run: mix deps.get
2525
- run: mix hex.publish --yes

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
## v1.0.39 (TBA)
44

5+
Now requires Elixir 1.14+.
6+
57
### Bug fixes
68

79
* [`Pow.Extension.Ecto.Schema`] Fixed deprecation warning in Elixir 1.18
10+
* [`Mix.Pow.Ecto.Migration`] Fixed compilation warning in Elixir 1.18
11+
* [`Pow.Ecto.Schema`] Fixed issues caused by changes in Ecto 3.12.0
812

913
## v1.0.38 (2024-04-11)
1014

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ config :my_app, :pow,
471471
cache_store_backend: Pow.Store.Backend.MnesiaCache
472472
```
473473

474-
Remember to add `:mnesia` to your `:extra_applications` so it'll be available for your release build. Mnesia will write files to the current working directory. The path can be changed with `config :mnesia, dir: '/path/to/dir'`.
474+
Remember to add `:mnesia` to your `:extra_applications` so it'll be available for your release build. Mnesia will write files to the current working directory. The path can be changed with `config :mnesia, dir: ~c"/path/to/dir"`.
475475

476476
The MnesiaCache requires write access. If you've got a read-only file system you should take a look at the [Redis cache backend store guide](guides/redis_cache_store_backend.md).
477477

guides/production_checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Update the config with `cache_store_backend: Pow.Store.Backend.MnesiaCache`.
3939
Mnesia will store the database files in the directory `./Mnesia.NODE` in the current working directory where `NODE` is the node name. By default, this is `./Mnesia.nonode@nohost`. You may wish to change the location to a shared directory so you can roll deploys:
4040

4141
```elixir
42-
config :mnesia, :dir, '/path/to/dir'
42+
config :mnesia, :dir, ~c"/path/to/dir"
4343
```
4444

4545
`:mnesia` should be added to `:extra_applications` in `mix.exs` for it to be included in releases.

lib/mix/pow/ecto/migration.ex

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ defmodule Mix.Pow.Ecto.Migration do
7070
defp pad(i), do: to_string(i)
7171

7272
# TODO: Remove by 1.1.0 and only use Ecto 3.0
73-
defp source_repo_priv(repo) do
74-
mod =
75-
if Pow.dependency_vsn_match?(:ecto, "< 3.0.0"),
76-
do: Mix.Ecto,
77-
else: Mix.EctoSQL
73+
@mod Pow.dependency_vsn_match?(:ecto, "< 3.0.0") && Mix.Ecto || Mix.EctoSQL
74+
75+
Code.ensure_loaded(@mod)
7876

79-
mod.source_repo_priv(repo)
77+
defp source_repo_priv(repo) do
78+
@mod.source_repo_priv(repo)
8079
end
8180
end

lib/pow/ecto/schema.ex

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,15 @@ defmodule Pow.Ecto.Schema do
273273

274274
@doc false
275275
def __filter_new_fields__(fields, existing_fields) do
276-
Enum.filter(fields, &not Enum.member?(existing_fields, {elem(&1, 0), elem(&1, 1)}))
276+
Enum.reject(fields, fn {key, type, _opts} ->
277+
Enum.find_value(existing_fields, fn
278+
{^key, {^type, _writable}} -> true
279+
{_key, {_type, _writable}} -> false
280+
# TODO: Remove the below once Ecto >= 3.12.0 is required
281+
{^key, ^type} -> true
282+
{_key, _type} -> false
283+
end)
284+
end)
277285
end
278286

279287
# TODO: Remove by 1.1.0
@@ -410,11 +418,14 @@ defmodule Pow.Ecto.Schema do
410418
end
411419

412420
defp missing_field?(name, type, existing_fields) when is_atom(name) do
413-
not Enum.any?(existing_fields, fn
414-
{^name, ^type} -> true
415-
{^name, e_type} -> not Type.primitive?(e_type)
416-
_any -> false
417-
end)
421+
case Keyword.get(existing_fields, name) do
422+
nil -> true
423+
{^type, _writable} -> false
424+
{e_type, _writable} -> Type.primitive?(e_type)
425+
# TODO: Remove the below once Ecto >= 3.12.0 is required
426+
^type -> false
427+
e_type -> Type.primitive?(e_type)
428+
end
418429
end
419430

420431
defp warn_missing_fields_error(module, field_defs) do

lib/pow/store/backend/mnesia_cache.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defmodule Pow.Store.Backend.MnesiaCache do
99
Mnesia will create a `Mnesia.Node` directory in the current working directory
1010
to write files to. This can be changed by setting the `-mnesia dir` config:
1111
12-
config :mnesia, dir: '/path/to/dir'
12+
config :mnesia, dir: ~c"/path/to/dir"
1313
1414
The directory path should be accessible, otherwise MnesiaCache will crash on
1515
startup.

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule Pow.MixProject do
77
[
88
app: :pow,
99
version: @version,
10-
elixir: "~> 1.12",
10+
elixir: "~> 1.14",
1111
elixirc_paths: elixirc_paths(Mix.env()),
1212
start_permanent: Mix.env() == :prod,
1313
compilers: Mix.compilers(),

0 commit comments

Comments
 (0)