Skip to content

Depend on ecto instead of ecto_sql#2116

Merged
Flo0807 merged 1 commit into
developfrom
feature/ecto-sql-to-ecto
Jul 17, 2026
Merged

Depend on ecto instead of ecto_sql#2116
Flo0807 merged 1 commit into
developfrom
feature/ecto-sql-to-ecto

Conversation

@Flo0807

@Flo0807 Flo0807 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What

Backpex declares {:ecto_sql, "~> 3.6"}, but nothing from :ecto_sql is used.

Evidence

The library uses Ecto.Query, Ecto.Changeset and Ecto.Repo — all of which live in the :ecto application, not :ecto_sql. :ecto_sql adds the SQL adapters, migrations and mix ecto.* tasks on top.

The only occurrences of an :ecto_sql module are inside documentation:

$ grep -rnE "Ecto\.Adapters|Ecto\.Migration|Ecto\.Migrator" lib/
lib/backpex/fields/upload.ex:205:        use Ecto.Migration
lib/backpex/fields/upload.ex:331:        use Ecto.Migration
lib/backpex/fields/upload.ex:449:        use Ecto.Migration

All three sit inside @moduledoc examples showing users how to write the migration for an upload field — they are documentation text, never compiled. Backpex's own test suite does not use a repo at all, and no adapter is configured in config/.

Impact

This is the only user-facing part: Backpex no longer pulls ecto_sql in transitively, only ecto.

In practice nothing changes — any application using Backpex has an Ecto.Repo backed by a SQL adapter, and therefore already declares ecto_sql itself. The demo does exactly that (demo/mix.exs:73) and compiles unchanged against this branch. What goes away is Backpex constraining the version of a package it never touches, which is what turned number's stale decimal pin into a blocked ecto_sql 3.14 update (#2113).

If you would rather keep the declaration as a convenience for users, the alternative is to leave ecto_sql in place — happy to close this.

Verification

  • mix lint passes end to end (compile --warning-as-errors, deps.unlock --unused, format, credo, 100 doctests + 174 tests, 0 failures).
  • mix docs --warnings-as-errors builds.
  • The demo resolves and compiles cleanly, with ecto_sql still in demo/mix.lock via its own declaration.

Context

Found by a dependency check I am preparing separately, which reports dependencies that are declared but never referenced by the compiled code — the blind spot mix deps.unlock --check-unused cannot cover, since it only compares mix.lock against mix.exs.

Backpex only uses Ecto.Query, Ecto.Changeset and Ecto.Repo, all of which live
in the :ecto application. Nothing from :ecto_sql is referenced — the only
`use Ecto.Migration` occurrences are inside @moduledoc examples, and neither
the library code nor its test suite touches Ecto.Adapters.

Declaring ecto_sql made Backpex constrain a package it does not use. Host
applications bring their own SQL adapter, so nothing changes for them in
practice.
@Flo0807 Flo0807 added the bug Something isn't working label Jul 17, 2026
@Flo0807
Flo0807 added this pull request to the merge queue Jul 17, 2026
Merged via the queue into develop with commit 7926ed9 Jul 17, 2026
8 checks passed
@Flo0807
Flo0807 deleted the feature/ecto-sql-to-ecto branch July 17, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant