diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a54f52d..d07218de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - New #328: Override `QueryBuilder::prepareBinary()` method (@Tigrov) - Chg #330: Update `QueryBuilder` constructor (@Tigrov) - Enh #329: Use `ColumnDefinitionBuilder` to generate table column SQL representation (@Tigrov) +- Enh #332: Remove `ColumnInterface` (@Tigrov) ## 1.2.0 March 21, 2024 diff --git a/src/Column.php b/src/Column.php deleted file mode 100644 index 2a69f760..00000000 --- a/src/Column.php +++ /dev/null @@ -1,52 +0,0 @@ -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. - * - * @psalm-suppress DeprecatedClass - * - * @deprecated Use {@see StringColumnSchema} or other column classes instead. Will be removed in 2.0.0. - */ -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::TYPE_CATEGORY_PK => '{type}{check}{append}', - self::TYPE_CATEGORY_NUMERIC => '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}', - self::TYPE_CATEGORY_UUID => '{type}{notnull}{unique}{default}{check}{comment}{append}', - self::TYPE_CATEGORY_UUID_PK => '{type}{notnull}{default}{check}{comment}{append}', - default => '{type}{length}{notnull}{unique}{check}{default}{append}', - }; - - return $this->buildCompleteString($format); - } -} diff --git a/src/QueryBuilder.php b/src/QueryBuilder.php index 329c8918..3f704820 100644 --- a/src/QueryBuilder.php +++ b/src/QueryBuilder.php @@ -5,8 +5,6 @@ namespace Yiisoft\Db\Sqlite; use Yiisoft\Db\Connection\ServerInfoInterface; -use Yiisoft\Db\Constant\ColumnType; -use Yiisoft\Db\Constant\PseudoType; use Yiisoft\Db\QueryBuilder\AbstractQueryBuilder; use Yiisoft\Db\Schema\QuoterInterface; use Yiisoft\Db\Schema\SchemaInterface; @@ -19,36 +17,6 @@ */ final class QueryBuilder extends AbstractQueryBuilder { - /** - * @var string[] Mapping from abstract column types (keys) to physical column types (values). - */ - protected array $typeMap = [ - PseudoType::PK => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', - PseudoType::UPK => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', - PseudoType::BIGPK => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', - PseudoType::UBIGPK => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', - ColumnType::CHAR => 'char(1)', - ColumnType::STRING => 'varchar(255)', - ColumnType::TEXT => 'text', - ColumnType::TINYINT => 'tinyint', - ColumnType::SMALLINT => 'smallint', - ColumnType::INTEGER => 'integer', - ColumnType::BIGINT => 'bigint', - ColumnType::FLOAT => 'float', - ColumnType::DOUBLE => 'double', - ColumnType::DECIMAL => 'decimal(10,0)', - ColumnType::DATETIME => 'datetime', - ColumnType::TIMESTAMP => 'timestamp', - ColumnType::TIME => 'time', - ColumnType::DATE => 'date', - ColumnType::BINARY => 'blob', - ColumnType::BOOLEAN => 'boolean', - ColumnType::MONEY => 'decimal(19,4)', - ColumnType::UUID => 'blob(16)', - PseudoType::UUID_PK => 'blob(16) PRIMARY KEY', - ColumnType::JSON => 'json', - ]; - public function __construct(QuoterInterface $quoter, SchemaInterface $schema, ServerInfoInterface $serverInfo) { parent::__construct( diff --git a/src/Schema.php b/src/Schema.php index 2fc9147f..fc505143 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -16,11 +16,9 @@ use Yiisoft\Db\Exception\InvalidConfigException; use Yiisoft\Db\Exception\NotSupportedException; use Yiisoft\Db\Helper\DbArrayHelper; -use Yiisoft\Db\Schema\Builder\ColumnInterface; use Yiisoft\Db\Schema\Column\ColumnFactoryInterface; use Yiisoft\Db\Schema\Column\ColumnSchemaInterface; use Yiisoft\Db\Schema\TableSchemaInterface; -use Yiisoft\Db\Sqlite\Column\ColumnBuilder; use Yiisoft\Db\Sqlite\Column\ColumnFactory; use function array_change_key_case; @@ -75,13 +73,6 @@ */ final class Schema extends AbstractPdoSchema { - /** @deprecated Use {@see ColumnBuilder} instead. Will be removed in 2.0. */ - public function createColumn(string $type, array|int|string $length = null): ColumnInterface - { - /** @psalm-suppress DeprecatedClass */ - return new Column($type, $length); - } - public function getColumnFactory(): ColumnFactoryInterface { return new ColumnFactory(); diff --git a/tests/ColumnSchemaBuilderTest.php b/tests/ColumnSchemaBuilderTest.php deleted file mode 100644 index 70ed4147..00000000 --- a/tests/ColumnSchemaBuilderTest.php +++ /dev/null @@ -1,26 +0,0 @@ -checkBuildString($expected, $type, $length, $calls); - } -} diff --git a/tests/Provider/ColumnSchemaBuilderProvider.php b/tests/Provider/ColumnSchemaBuilderProvider.php deleted file mode 100644 index 3577e81c..00000000 --- a/tests/Provider/ColumnSchemaBuilderProvider.php +++ /dev/null @@ -1,25 +0,0 @@ -