@@ -1301,6 +1301,8 @@ private function record_drop_constraint(
13011301 $ this ->record_drop_key ( $ table_is_temporary , $ table_name , $ name );
13021302 } elseif ( 'FOREIGN KEY ' === $ constraint_type ) {
13031303 $ this ->record_drop_foreign_key ( $ table_is_temporary , $ table_name , $ name );
1304+ } elseif ( 'CHECK ' === $ constraint_type ) {
1305+ $ this ->record_drop_check_constraint ( $ table_is_temporary , $ table_name , $ name );
13041306 } else {
13051307 throw new \Exception (
13061308 "DROP CONSTRAINT for constraint type ' $ constraint_type' is not supported. "
@@ -1398,6 +1400,37 @@ private function record_drop_foreign_key(
13981400 );
13991401 }
14001402
1403+ /**
1404+ * Analyze DROP CHECK statement and record data in the information schema.
1405+ *
1406+ * @param bool $table_is_temporary Whether the table is temporary.
1407+ * @param string $table_name The table name.
1408+ * @param string $name The check constraint name.
1409+ */
1410+ private function record_drop_check_constraint (
1411+ bool $ table_is_temporary ,
1412+ string $ table_name ,
1413+ string $ name
1414+ ): void {
1415+ $ this ->delete_values (
1416+ $ this ->get_table_name ( $ table_is_temporary , 'table_constraints ' ),
1417+ array (
1418+ 'CONSTRAINT_SCHEMA ' => $ this ->db_name ,
1419+ 'TABLE_NAME ' => $ table_name ,
1420+ 'CONSTRAINT_TYPE ' => 'CHECK ' ,
1421+ 'CONSTRAINT_NAME ' => $ name ,
1422+ )
1423+ );
1424+
1425+ $ this ->delete_values (
1426+ $ this ->get_table_name ( $ table_is_temporary , 'check_constraints ' ),
1427+ array (
1428+ 'CONSTRAINT_SCHEMA ' => $ this ->db_name ,
1429+ 'CONSTRAINT_NAME ' => $ name ,
1430+ )
1431+ );
1432+ }
1433+
14011434 /**
14021435 * Analyze "columnDefinition" or "fieldDefinition" AST node and extract column data.
14031436 *
0 commit comments