-
Notifications
You must be signed in to change notification settings - Fork 91
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
[WIP] Support associations and embeds #21
Conversation
… changeset Plugged that into PaperTrail.insert - the test works now.
non-bang functions now return a list of assoc_versions in the result map bang functions were upgraded to also insert assoc-related versions
@izelnakri I've got some more tests to write, clean up a few things and also implement strict mode (as soon as I understand what it does exactly), but otherwise, it looks like it's going to work really well. |
so SQL query debug log won't pollute the test output
use changeset.data when passing a changeset into get_all_children
@narrowtux thanks for all the work you've done so far and the TODOs that make the PR more understandable! Could you explain to me what this is for: "reduce changesets to a simple map when not using UUID keys" ? |
Embeds use UUID keys by default, since ecto has to generate them and not a DB. That saves them from having to implement some kind of auto increment logic without a database (nearly impossible). So if someone is using UUID keys, we can store actual versions for each embed in the normal versions table. If not, the embeds have to be handled in a special way so that PaperTrail doesn't crash when updating a struct in the DB that has an updated embed inside. |
@narrowtux I'd love to see this added to paper_trail - do you plan on finishing this PR? I may be able to help you in the coming weeks/months. |
Sorry I kinda gave up on this, there was too much work to be done and every time I wanted to tackle an issue a rabbit hole of new issues opened. It has become clear to me that this project wasn't what I wanted it to be, which is fine, but I couldn't use it in our product. So in the end, I decided to write my own audit/history/revert library, don't want to plug it here though. |
I'm continuing the work on this in #60 |
113ce09
to
98522f0
Compare
a06c813
to
675d502
Compare
Closing this PR due to inactivity, please ping me when/if its ready to be reopened. |
This is a WIP Pull Request it is only made this early to allow discussion about the code
TODO
on_delete: :nillify_all
so those get a version record that the reference was set to null