Resources to migrate an Ecto Adapter from Ecto 2 to Ecto 3?

Hi! I’m trying to upgrade the MongoDB Ecto library to be compatible with Ecto 3. I’m seeing a ton of changes I can’t find any reference to in the upgrade docs. Multiple method signatures seem to have changed without any warning or mention. It’s very possible this is all well documented and I’m just looking in the wrong place! It’s also possible the adapter had these errors before and the upgrade to Ecto 3 just caused things to loudly break.

Either way, I’m wondering – besides the 10 bullet points or so here, ecto/CHANGELOG.md at master · elixir-ecto/ecto · GitHub, are there any resources to upgrade an Ecto adapter from Ecto 2 to 3? Does anyone have any tips to migrate the adapter?

Thanks!

Just as an example of things not mentioned anywhere in the upgrade docs, take the adapter.stream call:

In 2.2:

stream = adapter.stream(repo, meta, prepared, params, preprocessor, opts)

In 3.0

stream = adapter.stream(adapter_meta, query_meta, prepared, params, opts)

The stream function is no longer being passed a preprocessor, but there’s no mention of this breaking change in the upgrade docs. Again, I might be looking in the wrong place!

Digging through Git history, that specific change (removing the preprocessor argument) came from Move preprocessing out of adapters by fishcakez · Pull Request #2312 · elixir-ecto/ecto · GitHub

1 Like

Another example: DBConnection 2.0 removes ensure_all_started and it has no mention in the DB Connection Changelog. In fact, DB Connection 2.0 doesn’t have any upgrade notes for how to upgrade something using 1.0 to 2.0. At least, they’re not in the git repo.

I really love the documentation for elixir and phoenix, so I have to imagine I’m looking in the wrong place. I’m going a bit crazy wondering what’s going on. A “how-to” guide would be great, but I’ll settle for a simple, “We ripped these methods out. Good luck!” Any upgrade guides for DB Connection 1.x to 2.x anyone knows about?

Unfortunately I don’t have any insight, but you could try diff.hex.pm as a “last resort”, so to speak.

https://diff.hex.pm/diff/ecto/2.2.12..3.0.0

1 Like