We are on MYSQL 5.7 and when we create a column like so in our DDL
my_update_timestamp timestamp(6) NOT NULL
MySQL complains when we try to create the table with
Error 1067: Invalid default value for my_update_timestamp.
Is it possible to have a not nullable timestamp with no default value?
Best Answer
The usual mistake is to not include
(6)
on the default:See about 3/4 of the way down on https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html .
Also, consider that to set this to: https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp