Merge pull request #12554 from bancer/patch-1

Improve handling of CURRENT_TIMESTAMP default value
This commit is contained in:
Mark Story 2018-09-13 09:34:17 -04:00 committed by GitHub
commit 2273428dca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 3 deletions

View file

@ -3539,7 +3539,7 @@ class DboSource extends DataSource {
} 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');

View file

@ -6559,7 +6559,6 @@ class ModelReadTest extends BaseModelTest {
public function testBuildQueryCountI18nConditions() {
$this->skipIf(!$this->db instanceof Mysql, 'This test is only compatible with Mysql.');
$dbName = $this->db->config['database'];
j
$this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User');
$TestModel = new TranslatedArticle();
$TestModel->cacheQueries = false;

View file

@ -1061,7 +1061,7 @@ class FormHelper extends AppHelper {
$radioOptions = (array)$options['options'];
unset($options['options']);
} else {
$radioOptions = [];
$radioOptions = array();
}
$label = $this->_getLabel($fieldName, $options);