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

前端 未结 8 1698
说谎
说谎 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:33

    I work in a banking domain and we have this need - that the changes done by one user must only be reflected after being approved by another. The design we use is as below

    1. Main Table A
    2. Another Table B that stores the changed record (and so is exactly similar to the first) + 2 additional columns (an FKey to C and a code to indicate the kind of change)
    3. A third table C that stores all such records that need approval
    4. A fourth table D that stores history (you probably don't need this).

    I recommend this approach. It handles all scenarios including updates and deletions very gracefully.

提交回复
热议问题