From 4ec195f9c87ab71d8b12ba6225d8d3e29568c981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kurre=20Sta=CC=8Ahlberg?= Date: Tue, 27 Jun 2017 11:46:51 +0300 Subject: [PATCH 1/2] Fix error when default value is reported as CURRENT_TIMESTAMP() with parenthesis --- lib/Cake/Model/Datasource/Database/Mysql.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php index 95a89ec16..3a9c12961 100644 --- a/lib/Cake/Model/Datasource/Database/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Mysql.php @@ -352,7 +352,8 @@ class Mysql extends DboSource { if (in_array($fields[$column->Field]['type'], $this->fieldParameters['unsigned']['types'], true)) { $fields[$column->Field]['unsigned'] = $this->_unsigned($column->Type); } - if (in_array($fields[$column->Field]['type'], array('timestamp', 'datetime')) && strtoupper($column->Default) === 'CURRENT_TIMESTAMP') { + if (in_array($fields[$column->Field]['type'], array('timestamp', 'datetime')) && + in_array(strtoupper($column->Default), array('CURRENT_TIMESTAMP', 'CURRENT_TIMESTAMP()'))) { $fields[$column->Field]['default'] = null; } if (!empty($column->Key) && isset($this->index[$column->Key])) { From 32f6b96060217f36817ffabce12118ab01cd5757 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 2 Jul 2017 11:06:39 -0400 Subject: [PATCH 2/2] Fix formatting. --- lib/Cake/Model/Datasource/Database/Mysql.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php index 3a9c12961..7d7c2df25 100644 --- a/lib/Cake/Model/Datasource/Database/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Mysql.php @@ -353,7 +353,8 @@ class Mysql extends DboSource { $fields[$column->Field]['unsigned'] = $this->_unsigned($column->Type); } if (in_array($fields[$column->Field]['type'], array('timestamp', 'datetime')) && - in_array(strtoupper($column->Default), array('CURRENT_TIMESTAMP', 'CURRENT_TIMESTAMP()'))) { + in_array(strtoupper($column->Default), array('CURRENT_TIMESTAMP', 'CURRENT_TIMESTAMP()')) + ) { $fields[$column->Field]['default'] = null; } if (!empty($column->Key) && isset($this->index[$column->Key])) {