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
32
32
$ this ->forge = Database::forge ($ this ->db );
33
33
}
34
34
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
+
35
49
public function testGetFieldData (): void
36
50
{
37
51
$ fields = $ this ->db ->getFieldData ('test1 ' );
@@ -41,7 +55,7 @@ public function testGetFieldData(): void
41
55
(object ) [
42
56
'name ' => 'id ' ,
43
57
'type ' => 'int ' ,
44
- 'max_length ' => null ,
58
+ 'max_length ' => $ this -> isOldMySQL () ? 11 : null ,
45
59
'default ' => null , // The default value is not defined.
46
60
'primary_key ' => 1 ,
47
61
'nullable ' => false ,
@@ -65,7 +79,7 @@ public function testGetFieldData(): void
65
79
(object ) [
66
80
'name ' => 'int_default_0 ' ,
67
81
'type ' => 'int ' ,
68
- 'max_length ' => null ,
82
+ 'max_length ' => $ this -> isOldMySQL () ? 11 : null ,
69
83
'default ' => '0 ' , // int 0
70
84
'primary_key ' => 0 ,
71
85
'nullable ' => false ,
You can’t perform that action at this time.
0 commit comments