In one of my migrations, I add a column ‘dateCreated’ to all tables. This works fine for most tables, but throws a strange error on some of them:
'SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '0000-00-00' for column 'start_date' at row 1
The SQL being executed was: ALTER TABLE `payments` ADD `dateCreated` DATETIME NULL DEFAULT NULL'
A column ‘start_date’ exists allready, but I can’t see why this has anything to do with the newly created column.
This breaks my migration. The same SQL works fine when applied directly on the table in PhpMyAdmin. Does Yii add extra checks to the query, or am I missing something else?