What's the best way to store changes to database records that require approval before being visible?

前端 未结 8 1687
说谎
说谎 2020-12-07 13:44

I need to store user entered changes to a particular table, but not show those changes until they have been viewed and approved by an administrative user. While those chang

8条回答
  •  攒了一身酷
    2020-12-07 14:25

    As this is a web app i'm going to assume there are more reads than writes, and you want something reasonably fast, and your conflict resolution (i.e out of order approvals) results in the same behaviour -- latest update is the one that is used.

    Both of the strategies you propose are similar in they both hold one row per change set, have to deal with conflicts etc, the only difference being whether to store the data in one table or two. Given the scenario, two tables seems the better solution for performance reasons. You could also solve this with the one table and a view of the most recent approved changes if your database supports it.

提交回复
热议问题