Fix error when default value is reported as CURRENT_TIMESTAMP() with parenthesis

This commit is contained in:
Kurre Ståhlberg 2017-06-27 11:46:51 +03:00
parent 8cd930d19e
commit 4ec195f9c8

View file

@ -352,7 +352,8 @@ class Mysql extends DboSource {
if (in_array($fields[$column->Field]['type'], $this->fieldParameters['unsigned']['types'], true)) { if (in_array($fields[$column->Field]['type'], $this->fieldParameters['unsigned']['types'], true)) {
$fields[$column->Field]['unsigned'] = $this->_unsigned($column->Type); $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; $fields[$column->Field]['default'] = null;
} }
if (!empty($column->Key) && isset($this->index[$column->Key])) { if (!empty($column->Key) && isset($this->index[$column->Key])) {