Automatic defaults for TIMESTAMP columns can differ between databases or database configurations.
This mostly applies to a difference between MariaDB and MySQL, but a difference may also be seen in certain configurations of MySQL.
Essentially, currently MySQL will normally not apply any defaults to
TIMESTAMP columns, but MariaDB, earlier (possibly unsupported) versions of MySQL, and some (deprecated) configurations of MySQL will set
DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
- https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html , specifically:
TIMESTAMP and DATETIME columns have no automatic properties unless they are specified explicitly, with this exception: If the explicit_defaults_for_timestamp system variable is disabled, the first TIMESTAMP column has both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP if neither is specified explicitly.
- https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp which details the variable which can make MySQL behave differently
This can result in some unexpected behaviour if someone creates an Entity definition with no default, and the resulting SQL is installed on a system with a different database e.g.:
- on the author's system with MySQL no default is set, and the value is not automatically updated when the entity is saved
- on an end-user's system with MariaDB, the default is set to CURRENT_TIMESTAMP, and the field is updated every time the entity is saved without that field explicitly set
No evidence of the changed default will be visible in the XML schema or the resulting SQL code.