0

I'm working on a plugin to speed up WordPress queries by adding / changing indexes on WordPress tables.

My question is this: should I make my plugin refuse to work if the database version in $wp_db_version is greater than what I've tested with? It's now at 49752.

It seems from wp-admin/includes/upgrade.php that the core team sometimes adds or changes indexes, but that they haven't done so since the 4-byte utfmb4 character set came along.

What's the core team discipline for updating the database version number? In the past, have database updates appeared in the beta releases? (Giving me a chance to test my stuff before the release goes live.)

1
  • 1
    Not sure we can answer this here. Have you asked the core team about this topic?
    – kero
    Dec 15, 2021 at 14:20

1 Answer 1

1

I sorted this out. It looks like the core team rolls out new versions of the database with their beta program. So, it's plenty easy to get advance warning.

And, the database upgrades live in wp-admin/includes/upgrade.php.

There's a sequence of functions in there named things like upgrade_500, upgrade_560, upgrade_590. They're named for the WordPress version when they first become active: upgrade_560 is, for example, tied to version 5.6.

Working through those functions is like doing an archaeological dig. With each layer, you see what changed from the previous.

Database schema wise.

  • V4.2.0 database V 31351 handled the conversion to utfmb4 unicode, and introduced the prefix indexes like ALTER TABLE wp_usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191)).
  • V5.6, database V 49572 no longer has the column wp_posts.post_category.
  • V5.6, database V 49752 has the most recent upgrades for 5.8.x. No schema changes from V 49572. (Careful typing those version numbers, they're almost the same.)
  • V5.9beta, database V 51917 has no schema changes from V 49572.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.