I use Symfony 2.1.* with Doctrine 2.3.* and I am having the following problem:
When generating migrations for my mysql (5.5) database, it keeps generating queries for my datetime fields.
My model looks like this:
class User {
/**
* @var \DateTime $createdAt
*
* @ORM\Column(type="datetime", nullable=true, options={"default"=null})
*/
private $createdAt;
/**
* @var \DateTime $updatedAt
*
* @ORM\Column(type="datetime", nullable=true, options={"default"=null})
*/
private $updatedAt;
}
And this is the migration that gets generated every single time:
$this->addSql("ALTER TABLE user CHANGE created_at created_at DATETIME DEFAULT NULL, CHANGE updated_at updated_at DATETIME DEFAULT NULL");
It's driving me nuts, since I do a lot of restructuring and every time I have to remove these queries for +/- 15 different entities.
Is this a known issue, or am I doing something wrong?
As @BetaRide mentions above, you should just remove the options={"default"=null}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With