Automattic / Automattic/wp-codebox
fix: SQLite runtime rewrites normal DROP TABLE as temporary table
- Dominant language
- TypeScript
- Stars
- 16
- Forks
- 4
- Avg merge
- 59m
- Merged PRs (30d)
- 131
Description
## 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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the built-in SQLite PHPUnit runtime and reproduce the issue using the shown `$wpdb->query()` call with `databaseType: sqlite`. Trace how normal `DROP TABLE` is rewritten and how temporary-table metadata is accessed. Done means a normal table drop succeeds in the SQLite runtime and the related PHPUnit coverage can run without requiring MySQL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sqlite
- Domain
- databases, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100