Skip to content
Permalink
Browse files

Improve handling of CURRENT_TIMESTAMP default value

Resolves #12553.
  • Loading branch information...
bancer committed Sep 12, 2018
1 parent 4aa0df8 commit 1a62c147fee83c85ce69b90b0f4a550944a034de
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/Model/Datasource/DboSource.php
@@ -3539,7 +3539,7 @@ public function buildColumn($column) {
} elseif (isset($column['null']) && $column['null'] === false) {
$out .= ' NOT NULL';
}
if ($type === 'timestamp' && isset($column['default']) && strtolower($column['default']) === 'current_timestamp') {
if (in_array($type, array('timestamp', 'datetime')) && isset($column['default']) && strtolower($column['default']) === 'current_timestamp') {
$out = str_replace(array("'CURRENT_TIMESTAMP'", "'current_timestamp'"), 'CURRENT_TIMESTAMP', $out);
}
return $this->_buildFieldParameters($out, $column, 'afterDefault');

0 comments on commit 1a62c14

Please sign in to comment.
You can’t perform that action at this time.