Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust to Ecto's new parametrized representation #119

Closed
wants to merge 1 commit into from

Conversation

nimf
Copy link

@nimf nimf commented Aug 21, 2024

Ecto changed its parametrized representation from 3-tuple to 2-tuple since v3.12. (elixir-ecto/ecto#4419)

Before Ecto v3.12 it was:
{:parameterized, Ecto.Enum, %{...}}

Since Ecto v3.12 it is:
{:parameterized, {Ecto.Enum, %{...}}}

This has broken Ecto.Enum and Ecto.Embedded fields in live_admin.

The tests are green, but I'm not sure if I missed something.

Also, couldn't get dependencies agree without upgrading everything.

Ecto changed its parametrized representation from 3-tuple to 2-tuple since v3.12.

Before Ecto v3.12 it was:
{:parameterized, Ecto.Enum, %{...}}

Since Ecto v3.12 it is:
{:parameterized, {Ecto.Enum, %{...}}}
@tfwright
Copy link
Owner

Hi, thanks for bringing this to my attention. It is very surprising that Ecto has introduced a breaking change in a minor release, as I have found José to be extremely reticent to allow those at all. It makes me wonder if this is supposed to be a private API, which would incline me to remove dependence on it. That is suggested but unfortunately not confirmed in the thread you linked, and I don't see how it could be because as I recall this is returned by __schema__(:type, field). So, I think I need to do a little more digging on this.

@tfwright
Copy link
Owner

tfwright commented Aug 24, 2024

Changelog for 3.12 mentions that this is a "private representation" but I don't see how that can be true given that it is returned by a public API. Not sure what's up there but this change makes sense to me. The only problem is all the warnings introduced by the deps updates which are currently breaking CI. @nimf can you clarify here:

Also, couldn't get dependencies agree without upgrading everything.

Did you use the --all option when upgrading, or are all of the .lock changes just from updating the ecto deps?

edit

It looks like if I just replace the three ecto related deps, and run mix deps.get I see a lot fewer updates.

@nimf
Copy link
Author

nimf commented Aug 26, 2024

Hmm… for some reason when I upgraded just the ecto libs ‘mix deps.get’ was failing. I tried to find the minimal amount of changes to satisfy all requirements, but I had to update one thing after another until almost everything was upgraded.
I’ll try to figure it out tomorrow.

@nimf
Copy link
Author

nimf commented Aug 27, 2024

If I update just the :ecto and :ecto_sql I got

Unchecked dependencies for environment test:
* expo (Hex package)
  the dependency does not match the requirement "~> 0.4.0", got "1.0.0"
* table_rex (Hex package)
  the dependency does not match the requirement "~> 3.1.1", got "4.0.0"
** (Mix) Can't continue due to errors on dependencies

for test. And for dev:

Unchecked dependencies for environment dev:
* nimble_parsec (Hex package)
  the dependency nimble_parsec 1.4.0

  > In deps/makeup/mix.exs:
    {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [only: :dev, env: :prod, hex: "nimble_parsec", repo: "hexpm", optional: false]}

  does not match the requirement specified

  > In deps/makeup_elixir/mix.exs:
    {:nimble_parsec, "~> 1.2.3", [only: :dev, env: :prod, hex: "nimble_parsec", repo: "hexpm", optional: false]}

  Ensure they match or specify one of the above in your deps and set "override: true"
** (Mix) Can't continue due to errors on dependencies

How do you usually solve this?

@tfwright
Copy link
Owner

Weird. Originally I had updated phoenix_ecto as well, but I just tried without that and still couldn't replicate what you're seeing.

If I update just ecto I see this error:

Resolving Hex dependencies...
Resolution completed in 0.029s
Because the lock depends on ecto_sql 3.10.2 which depends on ecto ~> 3.10.0, the lock requires ecto ~> 3.10.0.
And because your app depends on the lock, ecto ~> 3.10.0 is required.
So, because your app depends on ecto ~> 3.12, version solving failed.

But then bumping ecto_sql resolves it. I have to assume there is some difference in your local env, but I can't say what it would be based on what I'm seeing.

In order to get these changes in without the updates, I'm going to open my own PR, but thanks again for opening this!

@nimf
Copy link
Author

nimf commented Aug 27, 2024

Did you run ‘mix test’ after update?

@tfwright
Copy link
Owner

Closing in favor of 9d32862

@tfwright tfwright closed this Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants