What to do when I want to use database constraints but only mark as deleted instead of deleting?

后端 未结 10 1055
野的像风
野的像风 2020-12-31 20:55

I am working in a project where database items are not deleted, but only marked as deleted. Something like this:

id   name     deleted
---  -------  --------         


        
10条回答
  •  攒了一身酷
    2020-12-31 21:30

    Add a random hash after the unique name. Something that is easily reversible. Possibly separate with an underscore or some other character.

    Edit after comment: You could simply add underscore and the current timestamp.

提交回复
热议问题