mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 21:41:19 +08:00
Upgrade to PSR12 coding standard (#20121)
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
@ -266,7 +267,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
$columns = [reset($tableSchema->columns)->name];
|
||||
$defaultValue = 'DEFAULT';
|
||||
}
|
||||
|
||||
|
||||
foreach ($columns as $name) {
|
||||
$names[] = $this->db->quoteColumnName($name);
|
||||
$placeholders[] = $defaultValue;
|
||||
@ -312,8 +313,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
public function addCommentOnColumn($table, $column, $comment)
|
||||
{
|
||||
// Strip existing comment which may include escaped quotes
|
||||
$definition = trim(preg_replace("/COMMENT '(?:''|[^'])*'/i", '',
|
||||
$this->getColumnDefinition($table, $column)));
|
||||
$definition = trim(preg_replace("/COMMENT '(?:''|[^'])*'/i", '', $this->getColumnDefinition($table, $column)));
|
||||
|
||||
$checkRegex = '/CHECK *(\(([^()]|(?-2))*\))/';
|
||||
$check = preg_match($checkRegex, $definition, $checkMatches);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
@ -301,9 +302,11 @@ SQL;
|
||||
*
|
||||
* See details here: https://mariadb.com/kb/en/library/now/#description
|
||||
*/
|
||||
if (in_array($column->type, ['timestamp', 'datetime', 'date', 'time'])
|
||||
if (
|
||||
in_array($column->type, ['timestamp', 'datetime', 'date', 'time'])
|
||||
&& isset($info['default'])
|
||||
&& preg_match('/^current_timestamp(?:\(([0-9]*)\))?$/i', $info['default'], $matches)) {
|
||||
&& preg_match('/^current_timestamp(?:\(([0-9]*)\))?$/i', $info['default'], $matches)
|
||||
) {
|
||||
$column->defaultValue = new Expression('CURRENT_TIMESTAMP' . (!empty($matches[1]) ? '(' . $matches[1] . ')' : ''));
|
||||
} elseif (isset($type) && $type === 'bit') {
|
||||
$column->defaultValue = bindec(trim(isset($info['default']) ? $info['default'] : '', 'b\''));
|
||||
|
||||
Reference in New Issue
Block a user