Automattic / Automattic/wp-codebox
fix: SQLite runtime rewrites normal DROP TABLE as temporary table
- Vorherrschende Sprache
- TypeScript
- Sterne
- 17
- Forks
- 4
- Ø Merge
- 59 Min.
- Gemergte PRs (30 T.)
- 131
Beschreibung
## Summary
The built-in SQLite PHPUnit runtime rewrites a normal `DROP TABLE` query to `DROP TEMPORARY TABLE` and then fails because its temporary-table metadata table does not exist.
## Reproduction
Run Data Machine's selected PHPUnit file through WP Codebox 0.21.0 with `databaseType: sqlite`:
```php
$wpdb->query( $wpdb->prepare( 'DROP TABLE %i', $table_name ) );
```
## Observed
```text
Executing: DELETE FROM `_wp_sqlite_mysql_information_schema_tmp_tables`
WHERE `table_schema` = ? AND `table_name` = ?
SQLSTATE[HY000]: General error: 1 no such table:
_wp_sqlite_mysql_information_schema_tmp_tables
for query DROP TEMPORARY TABLE `wptests_datamachine_post_identity_reservations`
```
- WP Codebox CLI/runtime core: 0.21.0
- WordPress extension: 3.35.10
- Homeboy run: `2d72881b-24c9-4b3c-a1b5-8eb93b6a7cf0`
- The query remains a normal table drop under MySQL.
## Expected
`DROP TABLE` should drop the normal SQLite-backed table, or the temporary-table compatibility metadata should be initialized and consulted only for actual temporary tables.
## Impact
Portable schema-failure PHPUnit coverage cannot exercise missing-table behavior under WP Codebox's built-in SQLite runtime. The consumer test must currently remain MySQL-only despite the production repository otherwise supporting SQLite.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne mit der integrierten SQLite-PHPUnit-Laufzeitumgebung und reproduziere das Problem mit dem gezeigten `$wpdb->query()`-Aufruf mit `databaseType: sqlite`. Verfolge, wie normales `DROP TABLE` umgeschrieben wird und wie auf Metadaten temporärer Tabellen zugegriffen wird. Erledigt bedeutet, dass das Löschen einer normalen Tabelle in der SQLite-Laufzeitumgebung erfolgreich ist und die zugehörige PHPUnit-Abdeckung ausgeführt werden kann, ohne MySQL zu benötigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php, sqlite
- Bereich
- databases, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 55/100