ecto_sql icon indicating copy to clipboard operation
ecto_sql copied to clipboard

Add `:constraint_handler` and `Ecto.Adapters.SQL.Constraint`

Open petermueller opened this issue 1 year ago • 7 comments
trafficstars

  • [x] allows setting a :constraint_handler option in locations similar to :prefix
    • [x] config
    • [x] start_link
    • [x] per operation
  • [x] adds Ecto.Adapters.SQL.Constraint to replace c:Ecto.Adapters.SQL.Connection.to_constraints/2
  • [ ] moves existing to_constraints/2 to new modules for the built-in adapters
    • [x] Ecto.Adapters.MyXQL.Constraint
    • [ ] Ecto.Adapters.Postgres.Constraint
    • [ ] Ecto.Adapters.Tds.Constraint
  • still calls the connection's to_constraints/2 for the time being to allow downstream adapters to adopt
  • delegates the built-in adapter connections' to_constraints/2 to the new modules
    • e.g. Ecto.Adapters.MyXQL.Connection.to_constraints/2 -> Ecto.Adapters.MyXQL.Constraint.to_constraints/2
  • [ ] adds tests for the built-in adapters verifying custom constraint handlers work
    • [x] MyXQL
    • [ ] Postgres
    • [ ] Tds
  • [ ] adds documentation of how and when this feature is useful and how to use it

petermueller avatar Jul 29 '24 03:07 petermueller