-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Automatic sqlite-database-integration upgrade #136
Conversation
Improve stability and enable version comparisons for future upgrades.
Ensure new sites receive the latest sqlite-database-integration fixes and improvements.
fe6035d
to
2db6c54
Compare
Ensure existing sites receive the latest fixes and features.
If version comparison fails, assume the installed version is the latest. For example, fetching the latest version while offline will result in a comparison failure.
Avoid repeatedly fetching the latest versions each time a site starts.
2db6c54
to
f0aa6f2
Compare
Expanded the testing instructions in the description as I realized this will also fix https://github.com/Automattic/dotcom-forge/issues/6922 and https://github.com/Automattic/dotcom-forge/issues/6598. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested all the scenarios and worked great in all of them.
I added a few comments. My only suggestion is to use the same source, wp.org or GitHub, for the bundled version and the start/updated version.
Updated existing SQLite version from 2.1.7
to 2.1.10
sqlite-existing-site.mp4
sqlite-new-site.mp4
sqlite-woo.mp4
sqlite-updraft-plus.mp4
We only ever install the latest version, so we do not need the unnecessary complexity of fetching past versions. Also, this allows us to use the same download source the `sqlite-database-integration` plugin throughout the source.
I tested the plugin and I'm encountering the same JS exceptions outlined in https://github.com/Automattic/dotcom-forge/issues/6598:
I presume that using the latest SQLite version solved database errors, but as far as I've tested, I think this PR won't solve the issue. The plugin doesn't seem to function properly, clicking the Backup Now button results in no actions. |
Thank you for sharing this. From earlier testing, my perception was that this error was present for non-Playground sites as well, but it appears I was mistaken. I'll debug this further. |
The `-main` suffix is no longer accurate now that we rely upon release tags rather than downloading the latest development branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @sejas and @fluiddot for reviewing and helping me test this thoroughly. Apologies for the overlooked cases. I believe this is ready for review again.
- I updated the test case 4 (WooCommerce) to note that errors remain if MailPoet is activated.
- I removed test case 5 (UpdraftPlus) as the proposed changes do not address all the errors.
- I added test case 6 to ensure that fresh installations of Studio — which lack
sqlite-database-integration
plugin installations entirely — work as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎊 ! I've tested the different test scenarios and worked as expected. Thanks @dcalhoun for adding this feature 🏅 !
I added a comment that shouldn't block the PR but might be interesting to consider.
Nitpick: In the Important
section of Testing Instructions, there are references to the old SQLite filename sqlite-database-integration-main. I presume it should be
sqlite-database-integration, without the suffix
-main`.
function getSqliteVersionFromInstallation( installationPath: string ): string { | ||
let versionFileContent = ''; | ||
try { | ||
versionFileContent = fs.readFileSync( path.join( installationPath, 'load.php' ), 'utf8' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, we try to avoid using the sync version of FS functions to prevent blocking the main thread. I wonder if we could use the asynchronous one.
@fluiddot Thanks for the note! My thought is that testing old-version SQLite installations with and without the I updated the documentation account for both of these nuanced circumstances. |
Resolves https://github.com/Automattic/dotcom-forge/issues/6939.
Fixes https://github.com/Automattic/dotcom-forge/issues/6922.
Relates to https://github.com/Automattic/dotcom-forge/issues/6598.
Relates to #132.
Relates to https://github.com/Automattic/local-environment/pull/245 and https://github.com/Automattic/local-environment/pull/228.
Proposed Changes
sqlite-databse-integration
installation to the latest release tag on app start.sqlite-databse-integration
installation to the latest release tag on site server start.Testing Instructions
Important
In order to observe the
sqlite-integration-plugin
upgrade, you must first install a legacy version of the plugin.Check out the
trunk
branch.Download a legacy version of
sqlite-integration-plugin
— e.g., v2.1.9."Install" the legacy version by replacing the existing copy found in the following locations.
Note: naming the directory
sqlite-database-integration-main
(legacy name) would simulate testing the rollout of these changes to existing installs/sites; naming the directorysqlite-database-integration
(new name) would simulate testing an additional SQLite upgrade (second, third, etc) after a previous install (first SQLite upgrade, new site creation using these changes, etc).wp-files/sqlite-database-integration-main
.~/Library/Application\ Support/Studio/server-files/sqlite-database-integration-main
.Start the app server. (Note, you should not run
npm install
at this point as it would update the legacy bundled installation.)Create a new site ("Legacy Site").
Verify the Legacy Site's
wp-content/mu-plugins
directory contains the legacy version of the plugin.1: Site actions remain stable without a network connection
npm install
to download/bundle the latest version ofsqlite-database-integration
.2: New sites leverage the latest version
sqlite-integration-plugin
version found in the site'swp-content/mu-plugins
directory is the latest release.3: Existing sites upgrade when started
sqlite-integration-plugin
version found in the site'swp-content/mu-plugins
directory is the latest release.4: Woocommerce loads without database query errors
5: UpdraftPlus loads without database query errorsTest case removed as the proposed changes do not address all errors.
6: Fresh Studio installs successfully create and start sites
sqlite-database-integration
installations.npm install
to download/bundle the latest version ofsqlite-database-integration
.sqlite-integration-plugin
version found in the site'swp-content/mu-plugins
directory is the latest release.Pre-merge Checklist