Skip to content

Commit 376cc98

Browse files
committed
Use str_contains for the auto_increment EXTRA check
Match the str_contains predicate used by the column filter just above, so both call sites identify auto_increment columns the same way.
1 parent 9cb9ede commit 376cc98

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/mysql-on-sqlite/src/sqlite/class-wp-pdo-mysql-on-sqlite.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5135,7 +5135,7 @@ function ( $column ) use ( $is_strict_mode, $insert_map ) {
51355135
$position = array_search( $column['COLUMN_NAME'], $insert_list, true );
51365136
$identifier = $this->quote_sqlite_identifier( $select_list[ $position ] );
51375137
$value = $this->cast_value_for_saving( $column['DATA_TYPE'], $identifier );
5138-
$is_auto_increment = 'auto_increment' === $column['EXTRA'];
5138+
$is_auto_increment = str_contains( $column['EXTRA'], 'auto_increment' );
51395139

51405140
/*
51415141
* In MySQL, inserting 0 into an AUTO_INCREMENT column increments
@@ -6010,7 +6010,7 @@ private function get_sqlite_create_table_statement(
60106010
if (
60116011
'INTEGER' === $type
60126012
&& 'PRI' === $column['COLUMN_KEY']
6013-
&& 'auto_increment' !== $column['EXTRA']
6013+
&& ! str_contains( $column['EXTRA'], 'auto_increment' )
60146014
&& count( $grouped_constraints['PRIMARY'] ) === 1
60156015
) {
60166016
$type = 'INT';
@@ -6027,7 +6027,7 @@ private function get_sqlite_create_table_statement(
60276027
if ( 'NO' === $column['IS_NULLABLE'] ) {
60286028
$query .= ' NOT NULL';
60296029
}
6030-
if ( 'auto_increment' === $column['EXTRA'] ) {
6030+
if ( str_contains( $column['EXTRA'], 'auto_increment' ) ) {
60316031
$has_autoincrement = true;
60326032
$query .= ' PRIMARY KEY AUTOINCREMENT';
60336033
}
@@ -6337,7 +6337,7 @@ private function get_mysql_create_table_statement( bool $table_is_temporary, str
63376337
// Nullable "timestamp" columns dump NULL explicitly.
63386338
$sql .= ' NULL';
63396339
}
6340-
if ( 'auto_increment' === $column['EXTRA'] ) {
6340+
if ( str_contains( $column['EXTRA'], 'auto_increment' ) ) {
63416341
$sql .= ' AUTO_INCREMENT';
63426342
}
63436343

0 commit comments

Comments
 (0)