title: MySQL timestamp fields - created/modified
body: <p>I have recently decided to stop using MySQL triggers for my <code>created</code> and <code>modified</code> date fields in my tables due to complications when running scripts included in the setup file on client deployment.</p>
  
  <p>I have altered the fields this way: (example)</p>
  
  <pre><code>alter table users 
  modify `created` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'
  
  alter table users 
  modify `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP 
          ON UPDATE CURRENT_TIMESTAMP 
  </code></pre>
  
  <p>When I now run my program and fill in a form to add data (form controls are databound), I get the message "Column 'created' does not allows nulls".</p>
  
  <p>On already existing data, when I try to update, the modified date simply doesnt change.</p>
  
  <p>I have looked at many articles such as <a href="https://stackoverflow.com/questions/267658/having-both-a-created-and-last-updated-timestamp-columns-in-mysql-4-0">Having both a Created and Last Updated timestamp columns in MySQL 4.0</a> but cannot find a solution.</p>
  
  <p>How do I solve this?</p>
  
  <p>I am using MySQL v 5.6.15.0</p>