Comments (11)
sounds good.
from sequelize.
I have this feature completed.
New option: trackChanges
If set to true, a new table for the existing table is created: tablename_history
A field "updatedAt" keeps track of when the table was updated from the historical value.
from sequelize.
I have all of these features committed in my fork. Is there some thing can do to get you a copy?
from sequelize.
when u access the website of your forked repo there is a button named "send pull request" or smth like that :)
from sequelize.
Pull request sent.
from sequelize.
Hate to resurrect this issue, but was the PR successful?
from sequelize.
@faceleg i don't believe so.
from sequelize.
@faceleg The updatedAt column mentioned in the PR still exists, but I've never seen any of the other features mentioned.
However, this should actually be pretty easy to do as a plugin
- Add an afterDefine hook, which defines a
_history
model whenenver a model is defined. - In the same hook, add an afterCreate / afterUpdate hook to the model, which will insert a new row in the history table, each time a row is updated
- Perhaps also an afterDelete hook?
One problem might be bulk destroy / update. You could fix this by forcing individualHooks
to true with a beforeBulkUpdate/Destroy
hook
from sequelize.
Thanks @janmeier, I thought about doing that. Although I'd love to create a plugin like this I don't have time at the moment.
I'm going to investigate using this for the time being: https://github.com/2ndQuadrant/audit-trigger
from sequelize.
@janmeier would it be appropriate to open an issue "Creation of a revision tracking plugin", that listed requirements and suggested implementation as you have described?
Anyone looking to get their feet wet in some excellent OSS projects might see this and decide to implemented it.
Dreams are free
from sequelize.
@faceleg Sure, fine by me :)
from sequelize.
Related Issues (20)
- Special method/mixin "add" for BelongsToMany association overrides record instead of creating a new one
- SequelizeConnectionAcquireTimeoutError: Operation timeout HOT 3
- Regression between 6.35.1 and 6.35.2 - query stopped working. HOT 3
- Design Change Request: MS SQL UUID Type - `uniqueidentifier` not `char(36)` HOT 1
- I wish to optimize the method of findAll HOT 1
- sequelize.sync() does not create schemas HOT 1
- update操作
- update操作
- SQL parser issue for a specific combination of replacements, "?" symbol matching problem. HOT 3
- Defining HasMany association failed HOT 4
- Default default value is undefined, not null HOT 2
- Creating an array of enums with default value is failing HOT 1
- Incorrect handling of pg table aliases in JOIN ON clauses when using non-default schema in 7.0.0-alpha.37 HOT 1
- Include doesn't seem to work with TediousJS and MSSQL HOT 1
- Invalid Date when using sequelize.query HOT 1
- Syntax error when trying to add enum column with comment that ends with bracket ")". Unterminated quoted string. HOT 2
- Using 'returning' option for [Model].create() returns null values as undefined HOT 1
- Problems referencing associated query conditions that are not primary key fields | BUG! HOT 2
- Problems referencing associated query conditions that are not primary key fields
- where Fn Op.in tulp generates invalid sql 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 sequelize.