Prevent two users from editing the same data

前端 未结 4 1918
醉梦人生
醉梦人生 2021-01-13 18:46

I have seen a feature in different web applications including Wordpress (not sure?) that warns a user if he/she opens an article/post/page/whatever from the database, while

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-13 19:09

    Sounds like it will work fine. If you want to denormalize this and remove the extra Events table, just add a UserId and Timestamp field to the Articles table, as that is all you really need.

    You can easily check if the UserId doesn't match and if the Timestamp is less than 100 seconds old, then show the message.

    This way, you won't have to do any deletions on a separate table.

提交回复
热议问题