Adding Ecto 3 to an existing umbrella project

  • Antony Pinchbeck
  • 2019-02-19
  • Elixir

Adding Ecto 3 to an existing umbrella project

On a recent project I found that, on higher loaded servers, the application was too write heavy for SQLite. A decision was made with the client and Postgres was selected. During this move I decided that the best route would be to use Ecto rather than decoding the result sets from the Postgres driver.

After a look at the Ecto documentation

defp deps do
  [
    ...
    {:ecto_sql, "~> 3.0"},
    {:postgrex, ">= 0.0.0"}
    ...
  ]
end

and Ecto was added to the database application in the project.

This was where the fun started!

When running

> mix deps.get

mix hung on resolving dependencies and used all available memory!

After some digging and reordering of dependencies in the mix file I found out that ecto_sql uses a project called telemetry. This was ultimately clashing with one within the Umbrella project using the same name.

Some quick renaming and all was well.

Conclusion

Be careful with your application names (not that this is a hard problem!). In future I will be fully scoping projects in an umbrella.

© 2001 - 2024 Component X Software Limited All rights reserved.

2020-11-04