diff --git a/src/Schema.php b/src/Schema.php index fbc2073c..9cf5dd9b 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -82,7 +82,7 @@ final class Schema extends AbstractPdoSchema */ private const TYPE_MAP = [ 'tinyint' => self::TYPE_TINYINT, - 'bit' => self::TYPE_SMALLINT, + 'bit' => self::TYPE_BIT, 'boolean' => self::TYPE_BOOLEAN, 'bool' => self::TYPE_BOOLEAN, 'smallint' => self::TYPE_SMALLINT, @@ -518,14 +518,6 @@ private function getColumnType(string $dbType, array &$info): string if (($dbType === 'tinyint' || $dbType === 'bit') && $info['size'] === 1) { return self::TYPE_BOOLEAN; } - - if ($dbType === 'bit') { - return match (true) { - $info['size'] === 32 => self::TYPE_INTEGER, - $info['size'] > 32 => self::TYPE_BIGINT, - default => self::TYPE_SMALLINT, - }; - } } return self::TYPE_MAP[$dbType] ?? self::TYPE_STRING; diff --git a/tests/Provider/SchemaProvider.php b/tests/Provider/SchemaProvider.php index b8dee001..d401d2ff 100644 --- a/tests/Provider/SchemaProvider.php +++ b/tests/Provider/SchemaProvider.php @@ -210,7 +210,7 @@ public static function columns(): array 'defaultValue' => new Expression('CURRENT_TIMESTAMP'), ], 'bit_col' => [ - 'type' => 'smallint', + 'type' => 'bit', 'dbType' => 'bit(8)', 'phpType' => 'integer', 'primaryKey' => false, @@ -361,7 +361,7 @@ public static function columnsTypeBit(): array 'defaultValue' => true, ], 'bit_col_3' => [ - 'type' => 'integer', + 'type' => 'bit', 'dbType' => 'bit(32)', 'phpType' => 'integer', 'primaryKey' => false, @@ -374,7 +374,7 @@ public static function columnsTypeBit(): array 'defaultValue' => null, ], 'bit_col_4' => [ - 'type' => 'integer', + 'type' => 'bit', 'dbType' => 'bit(32)', 'phpType' => 'integer', 'primaryKey' => false, @@ -387,7 +387,7 @@ public static function columnsTypeBit(): array 'defaultValue' => 1, ], 'bit_col_5' => [ - 'type' => 'bigint', + 'type' => 'bit', 'dbType' => 'bit(64)', 'phpType' => 'integer', 'primaryKey' => false, @@ -400,7 +400,7 @@ public static function columnsTypeBit(): array 'defaultValue' => null, ], 'bit_col_6' => [ - 'type' => 'bigint', + 'type' => 'bit', 'dbType' => 'bit(64)', 'phpType' => 'integer', 'primaryKey' => false,