pow-auth / pow

Robust, modular, and extendable user authentication system
https://powauth.com
MIT License
1.59k stars 153 forks source link

ecto_sql 3.8.0 gives compilation error for generated user schema #664

Closed brolund closed 2 years ago

brolund commented 2 years ago

Steps to reproduce:

mix phx.new pow_bug --umbrella --no-assets --binary-id (this will use ecto_sql: ~> 3.6 which resolves to 3.8.0 a.t.m.) cd pow_bug_umbrella

Add dependencies:
{:pow, "~> 1.0.26"}, {:pow_assent, "~> 0.4.12"},

mix deps.get mix ecto.create cd apps/pow_bug mix pow.ecto.install --binary-id mix compile Results in:

Compiling 1 file (.ex)

== Compilation error in file lib/pow_bug/users/user.ex ==
** (ArgumentError) invalid option :null for field/3
    (ecto 3.8.0) lib/ecto/schema.ex:2214: Ecto.Schema.check_options!/3
    (ecto 3.8.0) lib/ecto/schema.ex:1911: Ecto.Schema.__field__/4
    (elixir 1.12.3) lib/enum.ex:930: Enum."-each/2-lists^foreach/1-0-"/2
    lib/pow_bug/users/user.ex:8: (module)

Change ecto_sql dependency to {:ecto_sql, "3.7.0"}, mix deps.get mix compile Compiles as expected

brolund commented 2 years ago

ecto_sql: "3.7.2" (latest 3.7 version) also works fine.

dfalling commented 2 years ago

I think it's caused by this: https://github.com/danschultzer/pow/blob/4fafa6dbfc4b1eef18d5f602f6c05e66d3ab9406/lib/pow/ecto/schema/fields.ex#L20

:null doesn't seem to be an option for field. It is an option for migrations.

Should I push a PR that simply drops null: false from this line?

ntodd commented 2 years ago

Looks like a PR has already been created: #665

danschultzer commented 2 years ago

Thanks! v1.0.27 is out, let me know if there's any issue with it! PowAssent update will be out momentarily.