-
Notifications
You must be signed in to change notification settings - Fork 108
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
Support Ecto v3.4.2 and rewrite ExAudit.Repo to extend Ecto.Repo #36
Conversation
This is a breaking change to support ecto and ecto_sql ~> 3.4 and at the same time to actually use ExAudit.Repo with Ecto.Repo. The Ecto.Repo @callback implementations are overriden to add version tracking if the given struct or changeset is in the list of :tracked_schemas specified in the config or call the original Ecto.Repo implementation otherwise.
* Tracks associated entities when they're created, updated or deleted in a single Repo call | ||
* Recursively tracks cascading deletions | ||
|
||
- Wraps Ecto.Repo, no need to change your existing codebase to start tracking changes |
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.
My IDE did this changes (- instead of *) automatically when I saved the file. I hope you don't mind 😅
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.
All this reformating makes it really hard to see what you actually changed.
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.
Sorry, I don't know why my VS Code formatter changed those.
I like what you did there, especially that we don't need to reimplement all repo functions any more. |
Yeah, I upgraded Ecto and started using Oban and got the debug log from the queues outputted in the console when they shouldn't so I replied a similar issue and the maintainer told me that it might be something with prepare_query. So after digging around I realized that it'd be better to avoid rewriting the whole Ecto.Repo @callback implementations to make ExAudit more easy to maintain with respect to Ecto upgrades and after a couple of days and designs I came up with this solution. Thx for this lib. I like it because of the clever way of auditing transparently and supporting assocs using the children traversal logic that is already implemented in Ecto.Repo.Schema. |
@narrowtux any chance we could get a new release? I have a working integration based off master (using Ecto 3.4.2) but I'd rather not leave it that way if I can change to a tag. |
Duh, I can just use the :ref option. Still, working with 3.4 is a big deal and seems worth a release. BTW, nice work on this lib! It's slick. |
Is there going to be a new release? am in need of this to work with Ecto 3.4 |
This is a breaking change to support ecto and ecto_sql ~> 3.4 and at the
same time to actually use ExAudit.Repo with Ecto.Repo.
The Ecto.Repo @callback implementations are overriden to add version tracking if the
given struct or changeset is in the list of :tracked_schemas specified in the config
or call the original Ecto.Repo implementation otherwise.