-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Prevent adding global_unique_id to old schema versions #49472
Conversation
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
Hi @PanosSynetos, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
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.
Manually tested and we're good - No fatal errors and I can checkout.
Approving.
@@ -223,6 +223,7 @@ public static function get_default_option_permissions() { | |||
'woocommerce_private_link', | |||
'woocommerce_share_key', | |||
'woocommerce_show_lys_tour', | |||
'woocommerce_schema_version', |
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.
Out of curiosity, why do we need this change?
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 had to add this here in order for it to have edit permission through WC Test Helper, so that the testing instructions can be executed.
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.
Oh ok, then we could remove this and not commit it - instead we could update the value with wp cli (that's how I actually did it)
wp option update woocommerce_schema_version 430
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.
Good call! I'll update the testing instructions.
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! Tested by switching to branch with WC version already set to 9.2 so that update routine won't run. Verified that schema is still at 430, and was able to complete the checkout.
Repeated the same test with deleting wc version first so that update routine is triggered. Verified that update routine was triggered and new column was added on next request. Was able to complete a checkout.
* Update changelog from PR that added new field to product lookup table * Update db_version variable and use it to prevent adding global_unique_id when the lookup table was not yet updated * Add woocommerce_schema_version to get_default_option_permissions * Add changelog * Remove schema version from default_option_permissions
* Update changelog from PR that added new field to product lookup table * Update db_version variable and use it to prevent adding global_unique_id when the lookup table was not yet updated * Add woocommerce_schema_version to get_default_option_permissions * Add changelog * Remove schema version from default_option_permissions
Submission Review Guidelines:
Changes proposed in this Pull Request:
This adds a guard to ensure the checkout continues to run successfully in case the database update fails for some reason, during WooCommerce update.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
I couldn't think of a way of testing this without database access, as it's a very specific scenario to reproduce.
WooCommerce > Status > Tools > Verify base database tables
and click on 'Verify database'wp option update woocommerce_schema_version 430
to update the option to 430.global_unique_id
column from thewp_wc_product_meta_lookup
tableAt the end of testing, make sure to run
Verify database
again.Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment