-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add :constraint_handler
and Ecto.Adapters.SQL.Constraint
#627
base: master
Are you sure you want to change the base?
Add :constraint_handler
and Ecto.Adapters.SQL.Constraint
#627
Conversation
This is a proof of concept PR, from the original thread on the Google Group. I have not yet swapped the The main things I could use some insights and feedback on are:
All 4 of these items are somewhat interconnected, and affect the possible options of others. e.g. doing # 4 would be neat for allowing downstream libraries an escape hatch in case they structure their config differently, but it might make more sense to just put it in the As it is currently written, it should work for downstream libraries without breaking them, but it does not provide a clear path, primarily because I did not want to go down a particular direction without input. Let me know what you think 🙂 |
The mysql tests are reliant on an I can also just open a PR on |
num = @base_migration + System.unique_integer([:positive]) | ||
ExUnit.CaptureLog.capture_log(fn -> | ||
:ok = up(PoolRepo, num, ConstraintMigration, log: false) | ||
end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than moving this migration here, the other changes to this test are from mix format
I checked through the dependent libraries I could find from hex and I didn't really see many others that were sticking to the typical patterns from the built-in adapters, but maybe I just missed some. But I think if we just removed the EDIT: I don't know how I missed the SQLite adapter. They'd be affected probably |
Given it is a single function, can we make the contract a MFArgs instead of a module? This way we don't need to create new modules for every new adapter. We can just point to the existing function. Thank you. |
Don't worry I'm watching this 😈 |
defaults to existing adapter connection module
d1c5bd2
to
4f80046
Compare
:constraint_handler
option in locations similar to:prefix
start_link
Ecto.Adapters.SQL.Constraint
to replacec:Ecto.Adapters.SQL.Connection.to_constraints/2
to_constraints/2
to new modules for the built-in adaptersEcto.Adapters.MyXQL.Constraint
Ecto.Adapters.Postgres.Constraint
Ecto.Adapters.Tds.Constraint
to_constraints/2
for the time being to allow downstream adapters to adoptto_constraints/2
to the new modulesEcto.Adapters.MyXQL.Connection.to_constraints/2
->Ecto.Adapters.MyXQL.Constraint.to_constraints/2
Postgres
Tds