title: Soft delete best practices (PHP/MySQL)
body: <p><strong>Problem</strong></p>
  
  <p>In a web application dealing with products and orders, I want to maintain information and relationships between former employees (users) and the orders they handled. I want to maintain information and relationships between obsolete products and orders which include these products.</p>
  
  <p>However I want employees to be able to de-clutter the administration interfaces, such as removing former employees, obsolete products, obsolete product groups etc.</p>
  
  <p>I'm thinking of implementing soft-deletion. So, how does one usually do this?</p>
  
  <p><strong>My immediate thoughts</strong></p>
  
  <p>My first thought is to stick a "<code>flag_softdeleted</code> TINYINT NOT NULL DEFAULT 0" column in every table of objects that should be soft deletable. Or maybe use a timestamp instead?</p>
  
  <p>Then, I provide a "Show deleted" or "Undelete" button in each relevant GUI. Clicking this button you will include soft-deleted records in the result. Each deleted record has a "Restore" button. Does this make sense?</p>
  
  <p>Your thoughts?</p>
  
  <p>Also, I'd appreciate any links to relevant resources.</p>