given a sql update like
ALTER TABLE #__table
CHANGE adddate
adddate
datetime NOT NULL DEFAULT CURRENT_TIMESTAMP()
and the adddate
column has CURRENT_TIMESTAMP() as default.
Maintenance: Database reports no problems
Maintenance: Database reports a problem
libraries/src/Schema/ChangeItem/MysqlChangeItem.php generates a checkQuery
generates
SHOW COLUMNS IN #__table
WHERE field = 'adddate' AND UPPER(type) = 'DATETIME' AND default
= current_timestamp()
should be
SHOW COLUMNS IN #__table
WHERE field = 'adddate' AND UPPER(type) = 'DATETIME' AND default
= 'current_timestamp()'
same for 'current_timestamp'
11.7.2-MariaDB-ubu2404
J53+ not checked in older versions
Labels |
Added:
No Code Attached Yet
|
Wouldn't it be sufficient to always quote the default value in the SHOW COLUMNS?
The ChangeItem classes in general do not support expressions as default values. It could be probably fixed for a few common expressions like e.g. current_timestamp() but not for all possible expressions as the expression is stored in a modified way in the information_schema, e.g. upper or lower case changed, and MySQL and MariaDB behave differently regarding that.