I've recently switched to MySQL 5.7 which causes troubles around datetimes. I have datetimes in my database with the default value of 0000-00-00 00:00:00
. MySQL 5.7 does not seem to like that type of default value. I understand I can set sql_mode = ''
but let's say I don't want to do that (sticking with the default strict mode), what would be the best approach?
I could first update all values:
UPDATE mycolumn SET field_datetime = NULL WHERE field_datetime='0000-00-00 00:00:00'
And then edit the datetime field to use NULL as default.
Would that be future proof? I assume MySQL 5.7 has its reasons to disallow
0000-00-00 00:00:00
.