Skip to content

Commit 8bc6652

Browse files
committed
Fix removing schema records for non-existent tables
1 parent a1d3b2c commit 8bc6652

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wp-includes/sqlite-ast/class-wp-sqlite-information-schema-reconstructor.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ public function ensure_correct_information_schema(): void {
7878
// Remove information schema records for tables that don't exist.
7979
foreach ( $information_schema_tables as $table ) {
8080
if ( ! in_array( $table, $sqlite_tables, true ) ) {
81-
$sql = sprintf( 'DROP %s', $this->quote_sqlite_identifier( $table ) );
81+
$sql = sprintf( 'DROP TABLE %s', $this->quote_sqlite_identifier( $table ) );
8282
$ast = $this->driver->create_parser( $sql )->parse();
8383
if ( null === $ast ) {
8484
throw new WP_SQLite_Driver_Exception( $this->driver, 'Failed to parse the MySQL query.' );
8585
}
86-
$this->schema_builder->record_drop_table( $ast );
86+
$this->schema_builder->record_drop_table(
87+
$ast->get_first_descendant_node( 'dropStatement' )
88+
);
8789
}
8890
}
8991
}

0 commit comments

Comments
 (0)