Skip to content

Commit 1a62c14

Browse files
authored
Improve handling of CURRENT_TIMESTAMP default value
Resolves #12553.
1 parent 4aa0df8 commit 1a62c14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Cake/Model/Datasource/DboSource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,7 @@ public function buildColumn($column) {
35393539
} elseif (isset($column['null']) && $column['null'] === false) {
35403540
$out .= ' NOT NULL';
35413541
}
3542-
if ($type === 'timestamp' && isset($column['default']) && strtolower($column['default']) === 'current_timestamp') {
3542+
if (in_array($type, array('timestamp', 'datetime')) && isset($column['default']) && strtolower($column['default']) === 'current_timestamp') {
35433543
$out = str_replace(array("'CURRENT_TIMESTAMP'", "'current_timestamp'"), 'CURRENT_TIMESTAMP', $out);
35443544
}
35453545
return $this->_buildFieldParameters($out, $column, 'afterDefault');

0 commit comments

Comments
 (0)