@@ -74,7 +74,7 @@ public function constraintsProvider()
74
74
$ result = parent ::constraintsProvider ();
75
75
76
76
$ result ['1: check ' ][2 ][0 ]->columnNames = null ;
77
- $ result ['1: check ' ][2 ][0 ]->expression = "( `C_check` <> _utf8mb4 \\ ' \\ ') " ;
77
+ $ result ['1: check ' ][2 ][0 ]->expression = "`C_check` <> '' " ;
78
78
$ result ['2: primary key ' ][2 ]->name = null ;
79
79
80
80
// Work aroung bug in MySQL 5.1 - it creates only this table in lowercase. O_o
@@ -95,6 +95,17 @@ public function testTableSchemaConstraints($tableName, $type, $expected): void
95
95
$ this ->expectException ('yii\base\NotSupportedException ' );
96
96
}
97
97
98
+ $ version = $ this ->getConnection (false )->getServerVersion ();
99
+
100
+ if (
101
+ \stripos ($ version , 'MariaDb ' ) === false &&
102
+ version_compare ($ version , '8.0.16 ' , '>= ' ) &&
103
+ $ tableName === 'T_constraints_1 ' &&
104
+ $ type === 'checks '
105
+ ) {
106
+ $ expected [0 ]->expression = "(`C_check` <> _utf8mb4 \\' \\') " ;
107
+ }
108
+
98
109
$ constraints = $ this ->getConnection (false )->getSchema ()->{'getTable ' . ucfirst ($ type )}($ tableName );
99
110
$ this ->assertMetadataEquals ($ expected , $ constraints );
100
111
}
@@ -111,6 +122,17 @@ public function testTableSchemaConstraintsWithPdoUppercase($tableName, $type, $e
111
122
$ this ->expectException ('yii\base\NotSupportedException ' );
112
123
}
113
124
125
+ $ version = $ this ->getConnection (false )->getServerVersion ();
126
+
127
+ if (
128
+ \stripos ($ version , 'MariaDb ' ) === false &&
129
+ version_compare ($ version , '8.0.16 ' , '>= ' ) &&
130
+ $ tableName === 'T_constraints_1 ' &&
131
+ $ type === 'checks '
132
+ ) {
133
+ $ expected [0 ]->expression = "(`C_check` <> _utf8mb4 \\' \\') " ;
134
+ }
135
+
114
136
$ connection = $ this ->getConnection (false );
115
137
$ connection ->getSlavePdo (true )->setAttribute (\PDO ::ATTR_CASE , \PDO ::CASE_UPPER );
116
138
$ constraints = $ connection ->getSchema ()->{'getTable ' . ucfirst ($ type )}($ tableName , true );
@@ -129,6 +151,17 @@ public function testTableSchemaConstraintsWithPdoLowercase($tableName, $type, $e
129
151
$ this ->expectException ('yii\base\NotSupportedException ' );
130
152
}
131
153
154
+ $ version = $ this ->getConnection (false )->getServerVersion ();
155
+
156
+ if (
157
+ \stripos ($ version , 'MariaDb ' ) === false &&
158
+ version_compare ($ version , '8.0.16 ' , '>= ' ) &&
159
+ $ tableName === 'T_constraints_1 ' &&
160
+ $ type === 'checks '
161
+ ) {
162
+ $ expected [0 ]->expression = "(`C_check` <> _utf8mb4 \\' \\') " ;
163
+ }
164
+
132
165
$ connection = $ this ->getConnection (false );
133
166
$ connection ->getSlavePdo (true )->setAttribute (\PDO ::ATTR_CASE , \PDO ::CASE_LOWER );
134
167
$ constraints = $ connection ->getSchema ()->{'getTable ' . ucfirst ($ type )}($ tableName , true );
0 commit comments