Best implementation for fully auditable data model?

前端 未结 6 1953
情深已故
情深已故 2021-02-06 14:36

My requirement is for a data model where a full audit trail is retained for changes to every attribute of every object. Object definitions are also fluid: new attributes can ap

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-06 15:20

    I don't think a particular database paradigm can be considered superior to any other for an audit log. It isn't so much a data model problem as it is a logging problem and can be considered somewhat orthogonal to the data store.

    That being said CouchDB can be configured to never delete old versions of documents. With the addition of a timestamp and possibly a user field to each document, you could use the feature to automatically keep an entire history of all the objects ever stored in the db. That might be the easiest out of the box setup for audit logging you could get in a database.

    As for the others I don't know what type of support they might have regarding this.

    Caveats:

    (You would also have to follow a never delete strategy for objects in the db and just mark objects deleted instead)

    (For an RDBMS the easiest solution might be a simple table that logs every insert, update, or delete statement run on the database in a text field with timestamp and user fields. I did that once on a postgres database and it worked pretty well for keeping history)

提交回复
热议问题