From 0eefbeec6dba3e923dc92b296f464f9a1ab2d797 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Sat, 27 Apr 2024 18:07:27 +0700 Subject: [PATCH] Update according to main PR --- src/Schema.php | 3 ++- tests/ColumnSchemaTest.php | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/Schema.php b/src/Schema.php index 9badfad6..43817018 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -480,7 +480,8 @@ private function loadColumnSchema(array $info): ColumnSchemaInterface $type = $this->getColumnType($dbType, $info); $isUnsigned = str_contains($dbType, 'unsigned'); /** @psalm-var ColumnInfo $info */ - $column = $this->createColumnSchema($type, $info['name'], unsigned: $isUnsigned); + $column = $this->createColumnSchema($type, unsigned: $isUnsigned); + $column->name($info['name']); $column->size($info['size'] ?? null); $column->precision($info['precision'] ?? null); $column->scale($info['scale'] ?? null); diff --git a/tests/ColumnSchemaTest.php b/tests/ColumnSchemaTest.php index 1c7a6dd5..e942084b 100644 --- a/tests/ColumnSchemaTest.php +++ b/tests/ColumnSchemaTest.php @@ -6,14 +6,12 @@ use PDO; use Yiisoft\Db\Command\Param; -use Yiisoft\Db\Expression\JsonExpression; use Yiisoft\Db\Schema\Column\BinaryColumnSchema; use Yiisoft\Db\Schema\Column\BooleanColumnSchema; use Yiisoft\Db\Schema\Column\DoubleColumnSchema; use Yiisoft\Db\Schema\Column\IntegerColumnSchema; use Yiisoft\Db\Schema\Column\JsonColumnSchema; use Yiisoft\Db\Schema\Column\StringColumnSchema; -use Yiisoft\Db\Schema\SchemaInterface; use Yiisoft\Db\Sqlite\Tests\Support\TestTrait; use Yiisoft\Db\Query\Query; use Yiisoft\Db\Tests\Common\CommonColumnSchemaTest; @@ -80,14 +78,6 @@ public function testPhpTypeCast(): void $db->close(); } - public function testTypeCastJson(): void - { - $columnSchema = new JsonColumnSchema('json_col'); - - $this->assertSame(['a' => 1], $columnSchema->phpTypecast('{"a":1}')); - $this->assertEquals(new JsonExpression(['a' => 1], SchemaInterface::TYPE_JSON), $columnSchema->dbTypecast(['a' => 1])); - } - public function testColumnSchemaInstance() { $db = $this->getConnection(true);