mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Changed name to append(), fixed phpdoc, added changelog
This commit is contained in:
@ -56,10 +56,10 @@ class ColumnSchemaBuilder extends Object
|
|||||||
*/
|
*/
|
||||||
protected $default;
|
protected $default;
|
||||||
/**
|
/**
|
||||||
* @var mixed SQL string to be appended to column schema string.
|
* @var mixed SQL string to be appended to column schema definition.
|
||||||
* @since 2.0.8
|
* @since 2.0.8
|
||||||
*/
|
*/
|
||||||
protected $plus;
|
protected $append;
|
||||||
/**
|
/**
|
||||||
* @var boolean whether the column values should be unsigned. If this is `true`, an `UNSIGNED` keyword will be added.
|
* @var boolean whether the column values should be unsigned. If this is `true`, an `UNSIGNED` keyword will be added.
|
||||||
* @since 2.0.7
|
* @since 2.0.7
|
||||||
@ -245,11 +245,11 @@ class ColumnSchemaBuilder extends Object
|
|||||||
* Specify additional SQL to be appended to schema string.
|
* Specify additional SQL to be appended to schema string.
|
||||||
* @param string $sql the SQL string to be appended.
|
* @param string $sql the SQL string to be appended.
|
||||||
* @return $this
|
* @return $this
|
||||||
* @since 2.0.8
|
* @since 2.0.9
|
||||||
*/
|
*/
|
||||||
public function plus($sql)
|
public function plus($sql)
|
||||||
{
|
{
|
||||||
$this->plus = $sql;
|
$this->append = $sql;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,10 +261,10 @@ class ColumnSchemaBuilder extends Object
|
|||||||
{
|
{
|
||||||
switch ($this->getTypeCategory()) {
|
switch ($this->getTypeCategory()) {
|
||||||
case self::CATEGORY_PK:
|
case self::CATEGORY_PK:
|
||||||
$format = '{type}{check}{comment}{plus}';
|
$format = '{type}{check}{comment}{append}';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{plus}';
|
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{append}';
|
||||||
}
|
}
|
||||||
return $this->buildCompleteString($format);
|
return $this->buildCompleteString($format);
|
||||||
}
|
}
|
||||||
@ -374,13 +374,13 @@ class ColumnSchemaBuilder extends Object
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the first constraint for the column. Defaults to unsupported.
|
* Builds the custom string that's appended to column definition.
|
||||||
* @return string a string containing the FIRST constraint.
|
* @return string custom string to append.
|
||||||
* @since 2.0.8
|
* @since 2.0.9
|
||||||
*/
|
*/
|
||||||
protected function buildPlusString()
|
protected function buildAppendString()
|
||||||
{
|
{
|
||||||
return $this->plus !== null ? ' ' . $this->plus : '';
|
return $this->append !== null ? ' ' . $this->append : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -420,10 +420,8 @@ class ColumnSchemaBuilder extends Object
|
|||||||
'{default}' => $this->buildDefaultString(),
|
'{default}' => $this->buildDefaultString(),
|
||||||
'{check}' => $this->buildCheckString(),
|
'{check}' => $this->buildCheckString(),
|
||||||
'{comment}' => $this->buildCommentString(),
|
'{comment}' => $this->buildCommentString(),
|
||||||
'{pos}' => ($this->isFirst) ?
|
'{pos}' => $this->isFirst ? $this->buildFirstString() : $this->buildAfterString(),
|
||||||
$this->buildFirstString() :
|
'{append}' => $this->buildAppendString(),
|
||||||
$this->buildAfterString(),
|
|
||||||
'{plus}' => $this->buildPlusString(),
|
|
||||||
];
|
];
|
||||||
return strtr($format, $placeholderValues);
|
return strtr($format, $placeholderValues);
|
||||||
}
|
}
|
||||||
|
@ -58,13 +58,13 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
|
|||||||
{
|
{
|
||||||
switch ($this->getTypeCategory()) {
|
switch ($this->getTypeCategory()) {
|
||||||
case self::CATEGORY_PK:
|
case self::CATEGORY_PK:
|
||||||
$format = '{type}{check}{pos}{comment}{plus}';
|
$format = '{type}{check}{pos}{comment}{append}';
|
||||||
break;
|
break;
|
||||||
case self::CATEGORY_NUMERIC:
|
case self::CATEGORY_NUMERIC:
|
||||||
$format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{pos}{plus}';
|
$format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{pos}{append}';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{pos}{plus}';
|
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{pos}{append}';
|
||||||
}
|
}
|
||||||
return $this->buildCompleteString($format);
|
return $this->buildCompleteString($format);
|
||||||
}
|
}
|
||||||
|
@ -58,13 +58,13 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
|
|||||||
{
|
{
|
||||||
switch ($this->getTypeCategory()) {
|
switch ($this->getTypeCategory()) {
|
||||||
case self::CATEGORY_PK:
|
case self::CATEGORY_PK:
|
||||||
$format = '{type}{length}{check}{comment}{pos}{plus}';
|
$format = '{type}{length}{check}{comment}{pos}{append}';
|
||||||
break;
|
break;
|
||||||
case self::CATEGORY_NUMERIC:
|
case self::CATEGORY_NUMERIC:
|
||||||
$format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{pos}{plus}';
|
$format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{pos}{append}';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{pos}{plus}';
|
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{pos}{append}';
|
||||||
}
|
}
|
||||||
return $this->buildCompleteString($format);
|
return $this->buildCompleteString($format);
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,13 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
|
|||||||
{
|
{
|
||||||
switch ($this->getTypeCategory()) {
|
switch ($this->getTypeCategory()) {
|
||||||
case self::CATEGORY_PK:
|
case self::CATEGORY_PK:
|
||||||
$format = '{type}{length}{check}{pos}{plus}';
|
$format = '{type}{length}{check}{pos}{append}';
|
||||||
break;
|
break;
|
||||||
case self::CATEGORY_NUMERIC:
|
case self::CATEGORY_NUMERIC:
|
||||||
$format = '{type}{length}{unsigned}{default}{notnull}{check}{pos}{plus}';
|
$format = '{type}{length}{unsigned}{default}{notnull}{check}{pos}{append}';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$format = '{type}{length}{default}{notnull}{check}{pos}{plus}';
|
$format = '{type}{length}{default}{notnull}{check}{pos}{append}';
|
||||||
}
|
}
|
||||||
return $this->buildCompleteString($format);
|
return $this->buildCompleteString($format);
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,13 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
|
|||||||
{
|
{
|
||||||
switch ($this->getTypeCategory()) {
|
switch ($this->getTypeCategory()) {
|
||||||
case self::CATEGORY_PK:
|
case self::CATEGORY_PK:
|
||||||
$format = '{type}{check}{plus}';
|
$format = '{type}{check}{append}';
|
||||||
break;
|
break;
|
||||||
case self::CATEGORY_NUMERIC:
|
case self::CATEGORY_NUMERIC:
|
||||||
$format = '{type}{length}{unsigned}{notnull}{unique}{check}{default}{plus}';
|
$format = '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$format = '{type}{length}{notnull}{unique}{check}{default}{plus}';
|
$format = '{type}{length}{notnull}{unique}{check}{default}{append}';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildCompleteString($format);
|
return $this->buildCompleteString($format);
|
||||||
|
Reference in New Issue
Block a user