Skip to content

Remove legacy SQLite driver and WP_SQLITE_AST_DRIVER feature flag#358

Draft
JanJakes wants to merge 7 commits intotrunkfrom
remove-legacy-driver
Draft

Remove legacy SQLite driver and WP_SQLITE_AST_DRIVER feature flag#358
JanJakes wants to merge 7 commits intotrunkfrom
remove-legacy-driver

Conversation

@JanJakes
Copy link
Copy Markdown
Member

@JanJakes JanJakes commented Apr 8, 2026

Summary

Remove the legacy, token-based MySQL-to-SQLite translator and the WP_SQLITE_AST_DRIVER feature flag. The AST-based driver is now the only driver.

Changes

  • Delete 6 legacy driver files (~8,700 lines) and 7 legacy test files (~5,000 lines), along with the root phpunit.xml.dist and composer.json test command.
  • Remove WP_SQLITE_AST_DRIVER conditionals and WP_SQLite_Translator branches from class-wp-sqlite-db.php, admin-page.php, constants.php, wp-mysql-proxy.php, and phpcs.xml.dist.
  • Remove legacy driver CI test step and unused phpunit-config workflow parameter.
  • Update AGENTS.md to reflect the removal.

Test plan

  • New driver tests pass (635 tests)
  • PHPCS clean on all changed files
  • CI passes

@joaopedrofrech
Copy link
Copy Markdown

This is amazing! are we finally moving to the new driver as default?

@chubes4
Copy link
Copy Markdown

chubes4 commented Apr 10, 2026

+1 to this! Would solve a problem for me when using https://github.com/Automattic/studio for local dev

Thanks for your efforts!

@JanJakes JanJakes force-pushed the remove-legacy-driver branch from aff0359 to 283fb3d Compare April 10, 2026 10:26
@JanJakes JanJakes changed the base branch from trunk to query-monitor-4-support April 10, 2026 10:26
@JanJakes JanJakes force-pushed the remove-legacy-driver branch from 283fb3d to eaecbf3 Compare April 10, 2026 10:35
Base automatically changed from query-monitor-4-support to trunk April 10, 2026 12:25
Remove the legacy, token-based MySQL-to-SQLite translator and its
supporting files. The new AST-based driver fully replaces it.

Removed files:
- class-wp-sqlite-translator.php
- class-wp-sqlite-lexer.php
- class-wp-sqlite-query-rewriter.php
- class-wp-sqlite-token.php
- class-wp-sqlite-pdo-user-defined-functions.php
- php-polyfills.php
Remove test files that tested the legacy translator, along with
the test bootstrap, schema helper, and root phpunit.xml.dist.
The new driver tests live in packages/mysql-on-sqlite/.

Removed files:
- tests/WP_SQLite_Translator_Tests.php
- tests/WP_SQLite_Query_Tests.php
- tests/WP_SQLite_Metadata_Tests.php
- tests/WP_SQLite_Query_RewriterTests.php
- tests/WP_SQLite_PDO_User_Defined_Functions_Tests.php
- tests/bootstrap.php
- tests/wp-sqlite-schema.php
- phpunit.xml.dist
The AST-based driver is now the only driver. Remove all conditional
logic that branched between the new and legacy driver:

- db.php: Always load the new driver.
- class-wp-sqlite-db.php: Remove WP_SQLite_Translator instanceof
  checks, simplify all methods to use WP_SQLite_Driver directly.
- install-functions.php: Always use WP_SQLite_Driver.
- admin-page.php: Remove "(AST)" suffix from admin bar.
- constants.php: Remove WP_SQLITE_AST_DRIVER env var handling.
- wp-setup.sh: Remove WP_SQLITE_AST_DRIVER env vars from Docker.
- wp-mysql-proxy.php: Remove WP_SQLITE_AST_DRIVER define.
- phpcs.xml.dist: Remove legacy translator exclusion.
Remove the "New and old driver" section and update the commands
section to remove legacy driver test commands.
Remove the "Run PHPUnit tests for the legacy driver" step that
ran root-level phpunit.xml.dist (now deleted). Also remove the
unused phpunit-config input parameter and PHPUNIT_CONFIG env var
that were only needed to switch between driver configs.
@JanJakes JanJakes force-pushed the remove-legacy-driver branch from eaecbf3 to 68d63c3 Compare April 10, 2026 12:29
The filter-based fallback to 'database_name_here' was added to ease early
adoption of the new AST-based driver in projects that didn't define DB_NAME.
With the legacy driver removed, simplify to a plain ternary — matching how
WPDB itself handles the constant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants