title: Doctrine schema update always try to add NOT NULL
body: <p>I have a fresh Symfony 2.8 installation, with doctrine and MySQL 5.6 stack.</p>
  
  <p>After executing a <code>doctrine:schema:update --force</code>, i can see<br>
  <code>Database schema updated successfully! "x" queries were executed</code></p>
  
  <p>Here is my problem : Even if i execute it multiple time, doctrine always find schema differences.</p>
  
  <p>With the <code>--dump-sql</code>, i can see that all of these queries are related to :  </p>
  
  <ul>
  <li>adding NOT NULL on <strong>string</strong> primary key </li>
  <li>adding NOT NULL on datetime
  field</li>
  </ul>
  
  <p>However, when i check my database, these columns already have a NOT NULL.</p>
  
  <p>Here is an example on a single property/column : </p>
  
  <pre><code>class MyEntity
  {
      /**
       * @ORM\Id
       * @ORM\Column(type="string", length=5, name="cd_key")
       * @ORM\GeneratedValue(strategy="AUTO")
       */
       private $code;
       ...  
  </code></pre>
  
  <p>Here is the result of a <code>SHOW CREATE TABLE my_entity;</code> : </p>
  
  <pre><code>CREATE TABLE `my_entity` (
    `cd_key` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
    `label` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `number` int(11) NOT NULL,
    PRIMARY KEY (`cd_key`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
  </code></pre>
  
  <p>And here the query doctrine try to execute with the <code>doctrine:schema:update</code> command : </p>
  
  <pre><code>ALTER TABLE my_entity CHANGE cd_key cd_key VARCHAR(5) NOT NULL;
  </code></pre>
  
  <ul>
  <li>I clean my Symfony cache between each command execution.</li>
  <li>I try to add <code>nullable=false</code> on @Column annotation (event if it's already defined as an @Id), but no effect.</li>
  <li>a <code>doctrine:schema:validate</code> don't find any mapping problem (except sync of course)</li>
  <li>I try to drop and recreate the full database, but no effet.</li>
  </ul>
  
  <p>Any ideas ?</p>