Repository navigation
Conversation
SQLite Database Integration 3.1 moves a database at wp-content/database/.ht.sqlite into a randomized directory the first time it loads, unless an explicit path is configured. Studio reads the database at the fixed path in many places. Define DB_PATH at the top of the db.php drop-in Studio generates, so the plugin keeps the database where it is. The drop-in is regenerated before a site starts, so existing sites get the constant before 3.1 loads. Sites that configure their own database path in wp-config.php are left alone. Bump SQLite Database Integration to 3.1.0.
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
DEFAULT 0push failure). That fix, Normalize zero defaults of temporal columns WordPress/sqlite-database-integration#542, ships in a 3.1.x release, and this PR is what lets Studio move to it.Important
Blocked on a
wp-cli-sqlite-commandrelease. Studio bundles the latest release of that command, currently v1.1.9. On SQLite Database Integration 3.1 it fatals withUndefined constant "Automattic\WP_CLI\SQLite\FQDB", which breaksstudio exportandstudio push. Automattic/wp-cli-sqlite-command#36 fixes this and is merged, but not released yet. Merge this after a release that includes #36. I'll also move the pin here to the 3.1.x release that contains #542 once it ships.How AI was used in this PR
Claude (Anthropic), via the Pi coding agent and a Homeboy cook, at Chris Huber's direction:
Chris reviewed the approach.
Proposed Changes
SQLite Database Integration 3.1 moves an existing
wp-content/database/.ht.sqliteinto a randomizedwp-content/database/.ht.<hex>/.ht.sqlitethe first time it loads, unless an explicit path is configured. Studio reads the database at the fixed path in many places: phpMyAdmin, blueprints, collation repair, journal mode, import/export, pull, and the AI prompt. All of those would lose the database.db.phpdrop-in Studio generates now starts with:DB_PATHis 3.1's explicit-path constant (SupportDB_PATHas the primary database path constant WordPress/sqlite-database-integration#512), so the plugin leaves the database in place. None of the places listed in Prepare for SQLite Database Integration 3.1's randomized database path #4981 need to change.start,create,export,pushandimport.wp-config.phpkeep it. The guard skips the definition, and custom SQLite drop-ins are still preserved.wp-content/databaseandwp-content/db.php, so the randomized path's defense against web downloads isn't needed for Studio sites.Testing Instructions
Upgrade an existing site:
npm run cli:build) and start the same site with it.wp-content/mu-plugins/sqlite-database-integration/load.phpreports 3.1.0 and thatwp-content/db.phpstarts with theDB_PATHdefinition.wp-content/database/still contains.ht.sqlite, and no.ht.<hex>/directory ordb-path.php.wp eval 'echo DB_PATH;'prints<site>/wp-content/database/.ht.sqlite.Export (needs
wp-cli-sqlite-commandwith #36): replaceapps/cli/dist/cli/wp-files/sqlite-commandwith a trunk build, then runstudio export. Check that:wp-content/databaseorwp-content/db.php;sql_mode='STRICT_TRANS_TABLES'.Without the
DB_PATHdefinition, step 4 shows the database moved into.ht.<hex>/.ht.sqlite. I verified this on a copy of the same site.Results:
wp-content/database/.ht.sqlite; post served;DB_PATHfixedDB_PATH.ht.<hex>/.ht.sqlitestudio exportwith bundled sqlite-command v1.1.9Undefined constant FQDB(blocker above)studio exportwith sqlite-command trunk (#36)vitest run packages/common/lib/tests/sqlite-integration.test.tsDB_PATHtest fails without the changenpm run typecheck --workspace packages/common, eslintNot covered: importing a Playground export that uses the randomized layout. The importer matches any
wp-content/database/**/.ht.sqliteand moves it to the fixed path, so it should work, but I haven't tested it.