Comments (3)
How does it deal with adding and removing fields in the schema?
It doesn't do anything special about it. Since it stores diffs of the data, it will have the changed field in the change list as an addition or removal the next time a change is recorded.
How to deal with data migrations (in migrations you cannot really use schema names as they might change or be removed)
I'm not sure what you want to achieve here. Do you want to change recorded versions or add a new version with the changes done in the migration? Let me say it like this, ex_audit won't prevent you from modifying the versions table manually, but design wise I haven't thought about this.
Would it be possible to also add a version that is not yet applied to the DB (like a draft).
Sure, you could add another field to the version schema that is a flag if something is a draft, and record the change manually, but I think this would be shoe-horning a feature ex_audit wasn't meant to do.
from ex_audit.
How does it deal with adding and removing fields in the schema?
It doesn't do anything special about it. Since it stores diffs of the data, it will have the changed field in the change list as an addition or removal the next time a change is recorded.
Neat this wasn't clear to me, but if it's just the diffed fields that's nice. I think this is indeed the best approach. When a field is deleted and it is present in a diff I presume nothing happens (no failures).
How to deal with data migrations (in migrations you cannot really use schema names as they might change or be removed)
I'm not sure what you want to achieve here. Do you want to change recorded versions or add a new version with the changes done in the migration? Let me say it like this, ex_audit won't prevent you from modifying the versions table manually, but design wise I haven't thought about this.
I was more thinking along the lines of when you add new fields with default values or values derived from other fields. As it just reverts diffs, it would handle that fine (probably the versions table doesn't need any change).
Would it be possible to also add a version that is not yet applied to the DB (like a draft).
Sure, you could add another field to the version schema that is a flag if something is a draft, and record the change manually, but I think this would be shoe-horning a feature ex_audit wasn't meant to do.
Yes went through the source code and with the diff approach future versions will be tricky. I think it's better to have a separate library that just stores a changeset/forward diff in a "drafts" table.
What would be super helpful for me is:
- A history function that is limited to the last # or versions (to solve a potential scaling issue when there a LOT of versions)
- A way to handle many-to-many relationships and storing them in the diff (do you already have an idea how to handle that?)
Both I can potentially PR.
from ex_audit.
What would be super helpful for me is:
A history function that is limited to the last # or versions (to solve a potential scaling issue when there a LOT of versions)
That's not possible currently, because it's only storing diffs. It could be solved by adding "keyframes" (like MPEG does it).
A way to handle many-to-many relationships and storing them in the diff (do you already have an idea how to handle that?)
This would need an extra table with 2 entity_id fields.
from ex_audit.
Related Issues (20)
- A way to use the original Repo HOT 5
- Handling Decimal changes HOT 5
- Support for multi schema versioning HOT 2
- Store patch as map(json) HOT 1
- Who reviews the pull requests? HOT 3
- Increased logging after switching to using ExAudit.Repo HOT 3
- Getting error when using ExAudit.Repo HOT 2
- Getting some errors on existing code HOT 1
- Tracking deletion of nested association in parent model update HOT 1
- Version 0.7 on hex.pm does not contain the same code as described in github HOT 2
- Restricting tracked_schemas makes versions unloadable HOT 4
- Callback Repo.reload missing HOT 2
- Wrong option key in documentation for ExAudit.Repo.history HOT 1
- Recording custom data with Plug does not work in Phoenix LiveView App HOT 1
- default_options/1 can't be overridden HOT 3
- Prefix support
- Conflicting behaviors using ExAudit.Repo HOT 3
- About maintaining this library. HOT 1
- New error prevent tracked schemas to write into DB HOT 1
- Using ex_audit breaks `returning` option for Repo functions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ex_audit.