stoic.alchemist
Hey guys, I finally got the green light to upgrade our Phoenix/Elixir stack and I’m in the middle of updating what needs to be updated.
The issue I found is that moving from Ecto 3.3.3 to 3.10.1 (didn’t think it was a big jump without being a major version change when upgrading Phoenix) I see parts of the logic broken because the code expects Ecto.Repo.update!/2 to return the struct (as I see it says on the docs) but instead I see it returns an Ecto Changeset. I see this is expected on a bunch of places on the code so I’d like to know if there was a change in behavior and Changeset is the new return and the docs are outdated (which means I need to update a bunch of places in the code) or if this is a bug and I should report it and change to a lower version of Ecto?
Thanks in advance.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
Hey @stoic.alchemist can you show code that exhibits this behavior, and the
IO.inspectoutput of the result? I have never seen this myself.stoic.alchemist
Sure thing, can’t show real code but I’ll emulate what’s happening:
Please let me know if this is good enough, this is just a simplification of what’s happening, the real code goes around to a bunch of files (I’m also skipping the Model definition and such, I don’t think it’s important but I may be wrong)
benwilson512
Hey @stoic.alchemist is
Ecto.Repo.update!a typo? That function is not callable directly. Not being able to show real code is definitely going to be a bit tricky.If you can’t show your code, can you show an example that reproduces this behavior?
dimitarvp
You are not supposed to call
Ecto.Repodirectly, you have to derive it via a macro in your own project. Then you use it like so:MyApp.Repo.update!.stoic.alchemist
Most definitely, we do have our own Repo definition, I’ll try to show as much as I can:
Repo definition:
Model definition:
Now the Model it’s already initialized somewhere in the code:
This results in a:
Being that I’m doing the upgrade I thought this was a change in behavior but the docs say otherwise
stoic.alchemist
benwilson512
The docs indicate that this shouldn’t be possible, the return type of Ecto.Repo — Ecto v3.14.0 is
Ecto.Schema.t(). Without code we can run this is pretty tricky to sort out, I’ve not seen anything like that before.dimitarvp
That’s a pretty weird and IMO unproductive test setup. I recommend you remove that fake repo.
stoic.alchemist
Yes, I agree, I’ll figure out why that’s there and remove it if it’s not needed, this can hide bugs (or in this case waste time searching for not-bugs )