for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Yiisoft\Db\Sqlite;
use Yiisoft\Db\Schema\Builder\AbstractColumn;
/**
* It's a utility that provides a convenient way to create column schema for use with {@see `\Yiisoft\Db\SQLite\Schema`}
* for SQLite.
*
* It provides methods for specifying the properties of a column, such as its type, size, default value, and whether it
* is nullable or not. It also provides a method for creating a column schema based on the specified properties.
* For example, the following code creates a column schema for an integer column:
* ```php
* $column = (new Column(SchemaInterface::TYPE_INTEGER))->notNull()->defaultValue(0);
* ```
* Provides a fluent interface, which means that the methods can be chained together to create a column schema with
* many properties in a single line of code.
*/
final class Column extends AbstractColumn
{
* Builds the unsigned string for column. Defaults to unsupported.
* @return string a string containing UNSIGNED keyword.
protected function buildUnsignedString(): string
return $this->isUnsigned() ? ' UNSIGNED' : '';
}
public function asString(): string
$format = match ($this->getTypeCategory()) {
self::CATEGORY_PK => '{type}{check}{append}',
self::CATEGORY_NUMERIC => '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}',
default => '{type}{length}{notnull}{unique}{check}{default}{append}',
};
return $this->buildCompleteString($format);