Never delete entries? Good idea? Usual?

前端 未结 10 628
感动是毒
感动是毒 2020-12-08 11:32

I am designing a system and I don\'t think it\'s a good idea to give the ability to the end user to delete entries in the database. I think that way because often then end u

10条回答
  •  甜味超标
    2020-12-08 12:00

    Yes and no.

    It will complicate your application much more than you expect since every table that does not allow deletion will be behind extra check (IsDeleted=false) etc. It does not sound much but then when you build larger application and in query of 11 tables 9 require chech of non-deletion.. it's tedious and error prone. (Well yeah, then there are deleted/nondeleted views.. when you remember to do/use them)

    Some schema upgrades will become PITA since you'll have to relax FK:s and invent "suitable" data for very, very old data.

    I've not tried, but have thought a moderate amount about solution where you'd zip the row data to xml and store that in some "Historical" table. Then in case of "must have that restored now OMG the world is dying!1eleven" it's possible to dig out.

提交回复
热议问题