diff --git a/tests/system/Database/Live/AbstractGetFieldDataTest.php b/tests/system/Database/Live/AbstractGetFieldDataTest.php index 859c37718902..1dc594094c30 100644 --- a/tests/system/Database/Live/AbstractGetFieldDataTest.php +++ b/tests/system/Database/Live/AbstractGetFieldDataTest.php @@ -91,6 +91,64 @@ protected function createTableForDefault() $this->forge->createTable($this->table); } + protected function createTableForType() + { + $this->forge->dropTable($this->table, true); + + // missing types: + // TINYINT,MEDIUMINT,BIT,YEAR,BINARY,VARBINARY,TINYTEXT,LONGTEXT, + // JSON,Spatial data types + // `id` must be INTEGER else SQLite3 error on not null for autoincrement field. + $fields = [ + 'id' => ['type' => 'INTEGER', 'constraint' => 20, 'auto_increment' => true], + 'type_varchar' => ['type' => 'VARCHAR', 'constraint' => 40, 'null' => true], + 'type_char' => ['type' => 'CHAR', 'constraint' => 10, 'null' => true], + // TEXT should not be used on SQLSRV. It is deprecated. + 'type_text' => ['type' => 'TEXT', 'null' => true], + 'type_smallint' => ['type' => 'SMALLINT', 'null' => true], + 'type_integer' => ['type' => 'INTEGER', 'null' => true], + 'type_float' => ['type' => 'FLOAT', 'null' => true], + 'type_numeric' => ['type' => 'NUMERIC', 'constraint' => '18,2', 'null' => true], + 'type_date' => ['type' => 'DATE', 'null' => true], + 'type_time' => ['type' => 'TIME', 'null' => true], + // On SQLSRV `datetime2` is recommended. + 'type_datetime' => ['type' => 'DATETIME', 'null' => true], + 'type_timestamp' => ['type' => 'TIMESTAMP', 'null' => true], + 'type_bigint' => ['type' => 'BIGINT', 'null' => true], + 'type_real' => ['type' => 'REAL', 'null' => true], + 'type_enum' => ['type' => 'ENUM', 'constraint' => ['appel', 'pears'], 'null' => true], + 'type_set' => ['type' => 'SET', 'constraint' => ['one', 'two'], 'null' => true], + 'type_mediumtext' => ['type' => 'MEDIUMTEXT', 'null' => true], + 'type_double' => ['type' => 'DOUBLE', 'null' => true], + 'type_decimal' => ['type' => 'DECIMAL', 'constraint' => '18,4', 'null' => true], + 'type_blob' => ['type' => 'BLOB', 'null' => true], + 'type_boolean' => ['type' => 'BOOLEAN', 'null' => true], + ]; + + if ($this->db->DBDriver === 'Postgre') { + unset( + $fields['type_enum'], + $fields['type_set'], + $fields['type_mediumtext'], + $fields['type_double'], + $fields['type_blob'] + ); + } + + if ($this->db->DBDriver === 'SQLSRV') { + unset( + $fields['type_set'], + $fields['type_mediumtext'], + $fields['type_double'], + $fields['type_blob'] + ); + } + + $this->forge->addField($fields); + $this->forge->addKey('id', true); + $this->forge->createTable($this->table); + } + abstract public function testGetFieldDataDefault(): void; protected function assertSameFieldData(array $expected, array $actual) diff --git a/tests/system/Database/Live/MySQLi/GetFieldDataTest.php b/tests/system/Database/Live/MySQLi/GetFieldDataTest.php index f5c9a0761ea4..93c1bddc9183 100644 --- a/tests/system/Database/Live/MySQLi/GetFieldDataTest.php +++ b/tests/system/Database/Live/MySQLi/GetFieldDataTest.php @@ -112,4 +112,183 @@ public function testGetFieldDataDefault(): void ]; $this->assertSameFieldData($expected, $fields); } + + public function testGetFieldDataType(): void + { + $this->createTableForType(); + + $fields = $this->db->getFieldData($this->table); + + $expected = [ + 0 => (object) [ + 'name' => 'id', + 'type' => 'int', + 'max_length' => $this->isOldMySQL() ? 20 : null, + 'nullable' => false, + 'default' => null, + 'primary_key' => 1, + ], + 1 => (object) [ + 'name' => 'type_varchar', + 'type' => 'varchar', + 'max_length' => 40, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 2 => (object) [ + 'name' => 'type_char', + 'type' => 'char', + 'max_length' => 10, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 3 => (object) [ + 'name' => 'type_text', + 'type' => 'text', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 4 => (object) [ + 'name' => 'type_smallint', + 'type' => 'smallint', + 'max_length' => $this->isOldMySQL() ? 6 : null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 5 => (object) [ + 'name' => 'type_integer', + 'type' => 'int', + 'max_length' => $this->isOldMySQL() ? 11 : null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 6 => (object) [ + 'name' => 'type_float', + 'type' => 'float', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 7 => (object) [ + 'name' => 'type_numeric', + 'type' => 'decimal', + 'max_length' => 18, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 8 => (object) [ + 'name' => 'type_date', + 'type' => 'date', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 9 => (object) [ + 'name' => 'type_time', + 'type' => 'time', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 10 => (object) [ + 'name' => 'type_datetime', + 'type' => 'datetime', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 11 => (object) [ + 'name' => 'type_timestamp', + 'type' => 'timestamp', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 12 => (object) [ + 'name' => 'type_bigint', + 'type' => 'bigint', + 'max_length' => $this->isOldMySQL() ? 20 : null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 13 => (object) [ + 'name' => 'type_real', + 'type' => 'double', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 14 => (object) [ + 'name' => 'type_enum', + 'type' => 'enum', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 15 => (object) [ + 'name' => 'type_set', + 'type' => 'set', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 16 => (object) [ + 'name' => 'type_mediumtext', + 'type' => 'mediumtext', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 17 => (object) [ + 'name' => 'type_double', + 'type' => 'double', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 18 => (object) [ + 'name' => 'type_decimal', + 'type' => 'decimal', + 'max_length' => 18, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 19 => (object) [ + 'name' => 'type_blob', + 'type' => 'blob', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 20 => (object) [ + 'name' => 'type_boolean', + 'type' => 'tinyint', + 'max_length' => 1, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + ]; + $this->assertSameFieldData($expected, $fields); + } } diff --git a/tests/system/Database/Live/OCI8/GetFieldDataTest.php b/tests/system/Database/Live/OCI8/GetFieldDataTest.php index 89750fd60bf8..ec985252214f 100644 --- a/tests/system/Database/Live/OCI8/GetFieldDataTest.php +++ b/tests/system/Database/Live/OCI8/GetFieldDataTest.php @@ -15,6 +15,8 @@ use CodeIgniter\Database\Live\AbstractGetFieldDataTest; use Config\Database; +use LogicException; +use stdClass; /** * @group DatabaseLive @@ -32,19 +34,30 @@ protected function createForge(): void $this->forge = Database::forge($this->db); } + private function getFieldMetaData(string $column, string $table): stdClass + { + $fields = $this->db->getFieldData($table); + + $name = array_search( + $column, + array_column($fields, 'name'), + true + ); + + if ($name === false) { + throw new LogicException('Field not found: ' . $column); + } + + return $fields[$name]; + } + public function testGetFieldDataDefault(): void { $this->createTableForDefault(); $fields = $this->db->getFieldData($this->table); - $data = []; - - foreach ($fields as $obj) { - $data[$obj->name] = $obj; - } - - $idDefault = $data['id']->default; + $idDefault = $this->getFieldMetaData('id', $this->table)->default; $this->assertMatchesRegularExpression('/"ORACLE"."ISEQ\$\$_[0-9]+".nextval/', $idDefault); $expected = [ @@ -107,4 +120,162 @@ public function testGetFieldDataDefault(): void ]; $this->assertSameFieldData($expected, $fields); } + + public function testGetFieldDataType(): void + { + $this->createTableForType(); + + $fields = $this->db->getFieldData($this->table); + + $expected = [ + 0 => (object) [ + 'name' => 'id', + 'type' => 'NUMBER', + 'max_length' => '20', + 'nullable' => false, + 'default' => $this->getFieldMetaData('id', $this->table)->default, + ], + 1 => (object) [ + 'name' => 'type_varchar', + 'type' => 'VARCHAR2', + 'max_length' => '40', + 'nullable' => true, + 'default' => null, + ], + 2 => (object) [ + 'name' => 'type_char', + 'type' => 'CHAR', + 'max_length' => '10', + 'nullable' => true, + 'default' => null, + ], + 3 => (object) [ + 'name' => 'type_text', + 'type' => 'VARCHAR2', + 'max_length' => '4000', + 'nullable' => true, + 'default' => null, + ], + 4 => (object) [ + 'name' => 'type_smallint', + 'type' => 'NUMBER', + 'max_length' => '5', + 'nullable' => true, + 'default' => null, + ], + 5 => (object) [ + 'name' => 'type_integer', + 'type' => 'NUMBER', + 'max_length' => '11', + 'nullable' => true, + 'default' => null, + ], + 6 => (object) [ + 'name' => 'type_float', + 'type' => 'FLOAT', + 'max_length' => '126', + 'nullable' => true, + 'default' => null, + ], + 7 => (object) [ + 'name' => 'type_numeric', + 'type' => 'NUMBER', + 'max_length' => '18', + 'nullable' => true, + 'default' => null, + ], + 8 => (object) [ + 'name' => 'type_date', + 'type' => 'DATE', + 'max_length' => '7', + 'nullable' => true, + 'default' => null, + ], + 9 => (object) [ + 'name' => 'type_time', + 'type' => 'DATE', + 'max_length' => '7', + 'nullable' => true, + 'default' => null, + ], + 10 => (object) [ + 'name' => 'type_datetime', + 'type' => 'DATE', + 'max_length' => '7', + 'nullable' => true, + 'default' => null, + ], + 11 => (object) [ + 'name' => 'type_timestamp', + 'type' => 'TIMESTAMP(6)', + 'max_length' => '11', + 'nullable' => true, + 'default' => null, + ], + 12 => (object) [ + 'name' => 'type_bigint', + 'type' => 'NUMBER', + 'max_length' => '19', + 'nullable' => true, + 'default' => null, + ], + 13 => (object) [ + 'name' => 'type_real', + 'type' => 'FLOAT', + 'max_length' => '63', + 'nullable' => true, + 'default' => null, + ], + 14 => (object) [ + 'name' => 'type_enum', + 'type' => 'VARCHAR2', + 'max_length' => '5', + 'nullable' => true, + 'default' => null, + ], + 15 => (object) [ + 'name' => 'type_set', + 'type' => 'VARCHAR2', + 'max_length' => '3', + 'nullable' => true, + 'default' => null, + ], + 16 => (object) [ + 'name' => 'type_mediumtext', + 'type' => 'VARCHAR2', + 'max_length' => '4000', + 'nullable' => true, + 'default' => null, + ], + 17 => (object) [ + 'name' => 'type_double', + 'type' => 'FLOAT', + 'max_length' => '126', + 'nullable' => true, + 'default' => null, + ], + 18 => (object) [ + 'name' => 'type_decimal', + 'type' => 'NUMBER', + 'max_length' => '18', + 'nullable' => true, + 'default' => null, + ], + 19 => (object) [ + 'name' => 'type_blob', + 'type' => 'BLOB', + 'max_length' => '4000', + 'nullable' => true, + 'default' => null, + ], + 20 => (object) [ + 'name' => 'type_boolean', + 'type' => 'NUMBER', + 'max_length' => '1', + 'nullable' => true, + 'default' => null, + ], + ]; + $this->assertSameFieldData($expected, $fields); + } } diff --git a/tests/system/Database/Live/Postgre/GetFieldDataTest.php b/tests/system/Database/Live/Postgre/GetFieldDataTest.php index 514bb7011c74..7ff4d57b5bce 100644 --- a/tests/system/Database/Live/Postgre/GetFieldDataTest.php +++ b/tests/system/Database/Live/Postgre/GetFieldDataTest.php @@ -98,4 +98,127 @@ public function testGetFieldDataDefault(): void ]; $this->assertSameFieldData($expected, $fields); } + + public function testGetFieldDataType(): void + { + $this->createTableForType(); + + $fields = $this->db->getFieldData($this->table); + + $expected = [ + 0 => (object) [ + 'name' => 'id', + 'type' => 'integer', + 'max_length' => '32', + 'nullable' => false, + 'default' => 'nextval(\'db_test1_id_seq\'::regclass)', + ], + 1 => (object) [ + 'name' => 'type_varchar', + 'type' => 'character varying', + 'max_length' => '40', + 'nullable' => true, + 'default' => null, + ], + 2 => (object) [ + 'name' => 'type_char', + 'type' => 'character', + 'max_length' => '10', + 'nullable' => true, + 'default' => null, + ], + 3 => (object) [ + 'name' => 'type_text', + 'type' => 'text', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 4 => (object) [ + 'name' => 'type_smallint', + 'type' => 'smallint', + 'max_length' => '16', + 'nullable' => true, + 'default' => null, + ], + 5 => (object) [ + 'name' => 'type_integer', + 'type' => 'integer', + 'max_length' => '32', + 'nullable' => true, + 'default' => null, + ], + 6 => (object) [ + 'name' => 'type_float', + 'type' => 'double precision', + 'max_length' => '53', + 'nullable' => true, + 'default' => null, + ], + 7 => (object) [ + 'name' => 'type_numeric', + 'type' => 'numeric', + 'max_length' => '18', + 'nullable' => true, + 'default' => null, + ], + 8 => (object) [ + 'name' => 'type_date', + 'type' => 'date', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 9 => (object) [ + 'name' => 'type_time', + 'type' => 'time without time zone', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 10 => (object) [ + 'name' => 'type_datetime', + 'type' => 'timestamp without time zone', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 11 => (object) [ + 'name' => 'type_timestamp', + 'type' => 'timestamp without time zone', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 12 => (object) [ + 'name' => 'type_bigint', + 'type' => 'bigint', + 'max_length' => '64', + 'nullable' => true, + 'default' => null, + ], + 13 => (object) [ + 'name' => 'type_real', + 'type' => 'real', + 'max_length' => '24', + 'nullable' => true, + 'default' => null, + ], + 14 => (object) [ + 'name' => 'type_decimal', + 'type' => 'numeric', + 'max_length' => '18', + 'nullable' => true, + 'default' => null, + ], + 15 => (object) [ + 'name' => 'type_boolean', + 'type' => 'boolean', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + ]; + $this->assertSameFieldData($expected, $fields); + } } diff --git a/tests/system/Database/Live/SQLSRV/GetFieldDataTest.php b/tests/system/Database/Live/SQLSRV/GetFieldDataTest.php index ada673292ddd..e6f924a28aba 100644 --- a/tests/system/Database/Live/SQLSRV/GetFieldDataTest.php +++ b/tests/system/Database/Live/SQLSRV/GetFieldDataTest.php @@ -98,4 +98,134 @@ public function testGetFieldDataDefault(): void ]; $this->assertSameFieldData($expected, $fields); } + + public function testGetFieldDataType(): void + { + $this->createTableForType(); + + $fields = $this->db->getFieldData($this->table); + + $expected = [ + 0 => (object) [ + 'name' => 'id', + 'type' => 'int', + 'max_length' => 10, + 'nullable' => false, + 'default' => null, + ], + 1 => (object) [ + 'name' => 'type_varchar', + 'type' => 'varchar', + 'max_length' => 40, + 'nullable' => true, + 'default' => null, + ], + 2 => (object) [ + 'name' => 'type_char', + 'type' => 'char', + 'max_length' => 10, + 'nullable' => true, + 'default' => null, + ], + 3 => (object) [ + 'name' => 'type_text', + 'type' => 'text', + 'max_length' => 2_147_483_647, + 'nullable' => true, + 'default' => null, + ], + 4 => (object) [ + 'name' => 'type_smallint', + 'type' => 'smallint', + 'max_length' => 5, + 'nullable' => true, + 'default' => null, + ], + 5 => (object) [ + 'name' => 'type_integer', + 'type' => 'int', + 'max_length' => 10, + 'nullable' => true, + 'default' => null, + ], + 6 => (object) [ + 'name' => 'type_float', + 'type' => 'float', + 'max_length' => 53, + 'nullable' => true, + 'default' => null, + ], + 7 => (object) [ + 'name' => 'type_numeric', + 'type' => 'numeric', + 'max_length' => 18, + 'nullable' => true, + 'default' => null, + ], + 8 => (object) [ + 'name' => 'type_date', + 'type' => 'date', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 9 => (object) [ + 'name' => 'type_time', + 'type' => 'time', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 10 => (object) [ + 'name' => 'type_datetime', + 'type' => 'datetime', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 11 => (object) [ + 'name' => 'type_timestamp', + 'type' => 'datetime', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + 12 => (object) [ + 'name' => 'type_bigint', + 'type' => 'bigint', + 'max_length' => 19, + 'nullable' => true, + 'default' => null, + ], + 13 => (object) [ + 'name' => 'type_real', + 'type' => 'real', + 'max_length' => 24, + 'nullable' => true, + 'default' => null, + ], + 14 => (object) [ + 'name' => 'type_enum', + 'type' => 'text', + 'max_length' => 2_147_483_647, + 'nullable' => true, + 'default' => null, + ], + 15 => (object) [ + 'name' => 'type_decimal', + 'type' => 'decimal', + 'max_length' => 18, + 'nullable' => true, + 'default' => null, + ], + 16 => (object) [ + 'name' => 'type_boolean', + 'type' => 'bit', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + ], + ]; + $this->assertSameFieldData($expected, $fields); + } } diff --git a/tests/system/Database/Live/SQLite3/GetFieldDataTest.php b/tests/system/Database/Live/SQLite3/GetFieldDataTest.php index 2f14d2f60ba4..319706a90e53 100644 --- a/tests/system/Database/Live/SQLite3/GetFieldDataTest.php +++ b/tests/system/Database/Live/SQLite3/GetFieldDataTest.php @@ -159,4 +159,183 @@ public function testGetFieldDataCompositePrimaryKey(): void ]; $this->assertSameFieldData($expected, $fields); } + + public function testGetFieldDataType(): void + { + $this->createTableForType(); + + $fields = $this->db->getFieldData($this->table); + + $expected = [ + 0 => (object) [ + 'name' => 'id', + 'type' => 'INTEGER', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 1, + ], + 1 => (object) [ + 'name' => 'type_varchar', + 'type' => 'VARCHAR', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 2 => (object) [ + 'name' => 'type_char', + 'type' => 'CHAR', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 3 => (object) [ + 'name' => 'type_text', + 'type' => 'TEXT', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 4 => (object) [ + 'name' => 'type_smallint', + 'type' => 'SMALLINT', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 5 => (object) [ + 'name' => 'type_integer', + 'type' => 'INTEGER', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 6 => (object) [ + 'name' => 'type_float', + 'type' => 'FLOAT', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 7 => (object) [ + 'name' => 'type_numeric', + 'type' => 'NUMERIC', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 8 => (object) [ + 'name' => 'type_date', + 'type' => 'DATE', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 9 => (object) [ + 'name' => 'type_time', + 'type' => 'TIME', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 10 => (object) [ + 'name' => 'type_datetime', + 'type' => 'DATETIME', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 11 => (object) [ + 'name' => 'type_timestamp', + 'type' => 'TIMESTAMP', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 12 => (object) [ + 'name' => 'type_bigint', + 'type' => 'BIGINT', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 13 => (object) [ + 'name' => 'type_real', + 'type' => 'REAL', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 14 => (object) [ + 'name' => 'type_enum', + 'type' => 'TEXT', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 15 => (object) [ + 'name' => 'type_set', + 'type' => 'TEXT', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 16 => (object) [ + 'name' => 'type_mediumtext', + 'type' => 'MEDIUMTEXT', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 17 => (object) [ + 'name' => 'type_double', + 'type' => 'DOUBLE', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 18 => (object) [ + 'name' => 'type_decimal', + 'type' => 'DECIMAL', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 19 => (object) [ + 'name' => 'type_blob', + 'type' => 'BLOB', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + 20 => (object) [ + 'name' => 'type_boolean', + 'type' => 'INT', + 'max_length' => null, + 'nullable' => true, + 'default' => null, + 'primary_key' => 0, + ], + ]; + $this->assertSameFieldData($expected, $fields); + } }