File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
tests/system/Database/Live/MySQLi Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,20 @@ protected function createForge(): void
3232 $ this ->forge = Database::forge ($ this ->db );
3333 }
3434
35+ /**
36+ * As of MySQL 8.0.17, the display width attribute for integer data types
37+ * is deprecated and is not reported back anymore.
38+ *
39+ * @see https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html
40+ */
41+ private function isOldMySQL (): bool
42+ {
43+ return ! (
44+ version_compare ($ this ->db ->getVersion (), '8.0.17 ' , '>= ' )
45+ && strpos ($ this ->db ->getVersion (), 'MariaDB ' ) === false
46+ );
47+ }
48+
3549 public function testGetFieldData (): void
3650 {
3751 $ fields = $ this ->db ->getFieldData ('test1 ' );
@@ -41,7 +55,7 @@ public function testGetFieldData(): void
4155 (object ) [
4256 'name ' => 'id ' ,
4357 'type ' => 'int ' ,
44- 'max_length ' => null ,
58+ 'max_length ' => $ this -> isOldMySQL () ? 11 : null ,
4559 'default ' => null , // The default value is not defined.
4660 'primary_key ' => 1 ,
4761 'nullable ' => false ,
@@ -65,7 +79,7 @@ public function testGetFieldData(): void
6579 (object ) [
6680 'name ' => 'int_default_0 ' ,
6781 'type ' => 'int ' ,
68- 'max_length ' => null ,
82+ 'max_length ' => $ this -> isOldMySQL () ? 11 : null ,
6983 'default ' => '0 ' , // int 0
7084 'primary_key ' => 0 ,
7185 'nullable ' => false ,
You can’t perform that action at this time.
0 commit comments