|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yiisoft\Db\Mysql; |
|
6
|
|
|
|
|
7
|
|
|
use Exception; |
|
8
|
|
|
use Yiisoft\Db\Schema\Builder\AbstractColumn; |
|
|
|
|
|
|
9
|
|
|
use Yiisoft\Db\Schema\QuoterInterface; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* It's a utility that provides a convenient way to create column schema for use with {@see `\Yiisoft\Db\Mysql\Schema`} |
|
13
|
|
|
* for MySQL, MariaDb Server. |
|
14
|
|
|
* |
|
15
|
|
|
* It provides methods for specifying the properties of a column, such as its type, size, default value, and whether it |
|
16
|
|
|
* is nullable or not. It also provides a method for creating a column schema based on the specified properties. |
|
17
|
|
|
* |
|
18
|
|
|
* For example, the following code creates a column schema for an integer column: |
|
19
|
|
|
* |
|
20
|
|
|
* ```php |
|
21
|
|
|
* $column = (new Column(SchemaInterface::TYPE_INTEGER))->notNull()->defaultValue(0); |
|
22
|
|
|
* ``` |
|
23
|
|
|
* |
|
24
|
|
|
* Provides a fluent interface, which means that the methods can be chained together to create a column schema with |
|
25
|
|
|
* many properties in a single line of code. |
|
26
|
|
|
*/ |
|
27
|
|
|
final class Column extends AbstractColumn |
|
28
|
|
|
{ |
|
29
|
|
|
private QuoterInterface|null $quoter = null; |
|
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Builds the unsigned string for column. Defaults to unsupported. |
|
33
|
|
|
* |
|
34
|
|
|
* @return string a string containing UNSIGNED keyword. |
|
35
|
|
|
*/ |
|
36
|
|
|
protected function buildUnsignedString(): string |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->isUnsigned() ? ' UNSIGNED' : ''; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Builds the comment specification for the column. |
|
43
|
|
|
* |
|
44
|
|
|
* @throws Exception |
|
45
|
|
|
* |
|
46
|
|
|
* @return string a string containing the COMMENT keyword and the comment itself. |
|
47
|
|
|
*/ |
|
48
|
|
|
protected function buildCommentString(): string |
|
49
|
|
|
{ |
|
50
|
|
|
if ($this->getComment() === null) { |
|
51
|
|
|
return ''; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
return ' COMMENT ' . (string) (new Quoter('`', '`'))->quoteValue($this->getComment()); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function asString(): string |
|
58
|
|
|
{ |
|
59
|
|
|
$format = match ($this->getTypeCategory()) { |
|
60
|
|
|
self::CATEGORY_PK => '{type}{length}{comment}{check}{append}', |
|
61
|
|
|
self::CATEGORY_NUMERIC => '{type}{length}{unsigned}{notnull}{default}{unique}{comment}{append}{check}', |
|
62
|
|
|
default => '{type}{length}{notnull}{default}{unique}{comment}{append}{check}', |
|
63
|
|
|
}; |
|
64
|
|
|
|
|
65
|
|
|
return $this->buildCompleteString($format); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths