Skip to content
Permalink
Browse files

Allow mariadb current_tiemstmap() default vlaue

  • Loading branch information...
raul338 committed Nov 28, 2017
1 parent c159efc commit a481ef785b30b8848933a9e763b03eb9493ff8d9
Showing with 6 additions and 1 deletion.
  1. +1 −1 src/Database/Schema/MysqlSchema.php
  2. +5 −0 tests/TestCase/Database/Schema/MysqlSchemaTest.php
@@ -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']);
@@ -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'],

0 comments on commit a481ef7

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