diff --git a/src/Generator/GenerateTypecast.php b/src/Generator/GenerateTypecast.php index faa51bb..58a88fc 100644 --- a/src/Generator/GenerateTypecast.php +++ b/src/Generator/GenerateTypecast.php @@ -73,6 +73,10 @@ private function typecast(AbstractColumn $column) return 'datetime'; } + if ($column->getType() === AbstractColumn::STRING) { + return 'string'; + } + return null; } } diff --git a/tests/Schema/Generator/TypecastGeneratorTest.php b/tests/Schema/Generator/TypecastGeneratorTest.php index 1c49bc4..a21f8ee 100644 --- a/tests/Schema/Generator/TypecastGeneratorTest.php +++ b/tests/Schema/Generator/TypecastGeneratorTest.php @@ -28,6 +28,7 @@ public function testCompiledUser(): void $this->assertSame('int', $schema['user'][Schema::TYPECAST]['p_id']); $this->assertSame('float', $schema['user'][Schema::TYPECAST]['p_balance']); $this->assertSame('datetime', $schema['user'][Schema::TYPECAST]['p_created_at']); + $this->assertSame('string', $schema['user'][Schema::TYPECAST]['p_name']); $this->assertTrue(in_array($schema['user'][Schema::TYPECAST]['p_id'], ['int', 'bool'])); }