title: Database Approve Reject WorkFlow
body: <p>I want to implement approve reject workflow using relational database. Currently i am using MS-SQL database along with NHibernate.</p>
  
  <p>Example:</p>
  
  <p>Lets say i have below entry in database</p>
  
  <pre><code>ID  Name    Location    FromDate    ToDate  ApprovalStatus
  1   ABCD    London       1-Jan      31-Dec  approved
  </code></pre>
  
  <p>now the logged in user can change the entry using front end... which will go for approval</p>
  
  <pre><code>ID  Name    Location    FromDate    ToDate  ApprovalStatus
  1   ABCD    London      1-Jan       30-Jun  edited
  </code></pre>
  
  <p>If the authority approves the editing then the edits should stay, but if the changes are rejected the i want to revert back the old entry.</p>
  
  <p>There are few ways to implement this, but all of them need lot of boilerplate code for each table and i have around 20-30 such entities which follow the approval process as shown above. The options I can think of are</p>
  
  <blockquote>
    <p>1.create another table which is replica of original table to   maintain the edited entries/ approval workflow. just .</p>
    
    <p>pros: easy to manage, just replace replace the original     entry in
    case of approval, delete in case of reject</p>
    
    <p>cons: too many duplicate tables + similar number of duplicate domain
    classes</p>
  </blockquote>
  
  <p>OR</p>
  
  <blockquote>
    <p>2.use same table, but create duplicate row, which keep track of the  parent row and does appropriate changes on approval/rejection.</p>
    
    <p>pros: reduces unnecessary tables &amp; domain classes</p>
    
    <p>cons: really complex to manage</p>
  </blockquote>
  
  <hr>
  
  <p>I think the scenario is pretty common and there must be some material/ framework/ architecture addressing this issue. though i am not able to find out anything relevant even after much googling...</p>
  
  <p>please help...</p>