Skip to content

Commit

Permalink
Improve handling of CURRENT_TIMESTAMP default value
Browse files Browse the repository at this point in the history
Resolves #12553.
  • Loading branch information
bancer committed Sep 12, 2018
1 parent 4aa0df8 commit 1a62c14
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/DboSource.php
Expand Up @@ -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');
Expand Down

0 comments on commit 1a62c14

Please sign in to comment.