Skip to content

Commit 8b82485

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 72c5ea6 commit 8b82485

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
@@ -5354,7 +5354,7 @@ function ( $column ) use ( $is_strict_mode, $insert_map ) {
53545354
$position = array_search( $column['COLUMN_NAME'], $insert_list, true );
53555355
$identifier = $this->quote_sqlite_identifier( $select_list[ $position ] );
53565356
$value = $this->cast_value_for_saving( $column['DATA_TYPE'], $identifier );
5357-
$is_auto_increment = 'auto_increment' === $column['EXTRA'];
5357+
$is_auto_increment = str_contains( $column['EXTRA'], 'auto_increment' );
53585358

53595359
/*
53605360
* In MySQL, inserting 0 into an AUTO_INCREMENT column increments
@@ -6229,7 +6229,7 @@ private function get_sqlite_create_table_statement(
62296229
if (
62306230
'INTEGER' === $type
62316231
&& 'PRI' === $column['COLUMN_KEY']
6232-
&& 'auto_increment' !== $column['EXTRA']
6232+
&& ! str_contains( $column['EXTRA'], 'auto_increment' )
62336233
&& count( $grouped_constraints['PRIMARY'] ) === 1
62346234
) {
62356235
$type = 'INT';
@@ -6246,7 +6246,7 @@ private function get_sqlite_create_table_statement(
62466246
if ( 'NO' === $column['IS_NULLABLE'] ) {
62476247
$query .= ' NOT NULL';
62486248
}
6249-
if ( 'auto_increment' === $column['EXTRA'] ) {
6249+
if ( str_contains( $column['EXTRA'], 'auto_increment' ) ) {
62506250
$has_autoincrement = true;
62516251
$query .= ' PRIMARY KEY AUTOINCREMENT';
62526252
}
@@ -6557,7 +6557,7 @@ private function get_mysql_create_table_statement( bool $table_is_temporary, str
65576557
// Nullable "timestamp" columns dump NULL explicitly.
65586558
$sql .= ' NULL';
65596559
}
6560-
if ( 'auto_increment' === $column['EXTRA'] ) {
6560+
if ( str_contains( $column['EXTRA'], 'auto_increment' ) ) {
65616561
$has_auto_increment = true;
65626562
$sql .= ' AUTO_INCREMENT';
65636563
}

0 commit comments

Comments
 (0)