Never delete entries? Good idea? Usual?

前端 未结 10 576
感动是毒
感动是毒 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 11:50

    I've been working on a project lately where all the data was kept in the DB as well. The status of each individual row was kept in an integer field (data could be active, deleted, in_need_for_manual_correction, historic).

    You should consider using views to access only the active/historic/... data in each table. That way your queries won't get more complicated.

    Another thing that made things easy was the use of UPDATE/INSERT/DELETE triggers that handled all the flag changing inside the DB and thus kept the complex stuff out of the application (for the most part).

    I should mention that the DB was a MSSQL 2005 server, but i guess the same approach should work with mysql, too.

提交回复
热议问题