Skip to content

Commit

Permalink
Allow mariadb current_tiemstmap() default vlaue
Browse files Browse the repository at this point in the history
  • Loading branch information
raul338 committed Nov 28, 2017
1 parent c159efc commit a481ef7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Database/Schema/MysqlSchema.php
Expand Up @@ -426,7 +426,7 @@ public function columnSql(TableSchema $schema, $name)
}
if (isset($data['default']) &&
in_array($data['type'], [TableSchema::TYPE_TIMESTAMP, TableSchema::TYPE_DATETIME]) &&
strtolower($data['default']) === 'current_timestamp'
in_array(strtolower($data['default']), ['current_timestamp', 'current_timestamp()'])
) {
$out .= ' DEFAULT CURRENT_TIMESTAMP';
unset($data['default']);
Expand Down
5 changes: 5 additions & 0 deletions tests/TestCase/Database/Schema/MysqlSchemaTest.php
Expand Up @@ -729,6 +729,11 @@ public static function columnSqlProvider()
['type' => 'timestamp', 'null' => false, 'default' => 'current_timestamp'],
'`created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'
],
[
'created',
['type' => 'timestamp', 'null' => false, 'default' => 'current_timestamp()'],
'`created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'
],
[
'open_date',
['type' => 'timestamp', 'null' => false, 'default' => '2016-12-07 23:04:00'],
Expand Down

0 comments on commit a481ef7

Please sign in to comment.