title: Inserting NULL into NOT NULL columns with Default Value
body: <p>For a bit of background, we use <strong>Zend Framework 2</strong> and <strong>Doctrine</strong> at work. Doctrine will always insert <code>NULL</code> for values we do not populate ourselves. Usually this is okay as if the field has a default value, then it SHOULD populate the field with this default value. </p>
  
  <p>For one of our servers running <strong>MySQL 5.6.16</strong> a query such as the one below runs and executes fine. Although <code>NULL</code> is being inserted into a field which is not nullable, MySQL populates the field with its default value on insert.</p>
  
  <p>On another of our servers running <strong>MySQL 5.6.20</strong>, we run the query below and it falls over because it complains that 'field_with_default_value' CANNOT be null.</p>
  
  <pre><code>INSERT INTO table_name(id, field, field_with_default_value) 
  VALUES(id_value, field_value, NULL);
  </code></pre>
  
  <p>Doctrine itself does not support passing through "DEFAULT" into the queries it builds so that is not an option. I figure this must be a MySQL server thing of some kind seeing as though it works okay in one version but not another, but unfortunately I have no idea what this could be. Our SQL Mode is also identical on both servers (<code>'NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'</code>).</p>
  
  <p>I should probably mention, if I actually run the above SQL in Workbench it still does not work in the same way. So it's not really a Doctrine issue but definitely a MySQL issue of some sort.</p>
  
  <p>Any help on this would be greatly appreciated.</p>