Environments: Add has_pending column to translate stats table#681
Closed
ocean90 wants to merge 1 commit into
Closed
Environments: Add has_pending column to translate stats table#681ocean90 wants to merge 1 commit into
ocean90 wants to merge 1 commit into
Conversation
…column. Production added a denormalized has_pending tinyint maintained by the stats writers (= waiting > 0 OR fuzzy > 0) plus a compound index locale(locale, locale_slug, has_pending) so the "find projects that need attention" queries become a range scan over the pending subset instead of a full table scan (production commit 733b8ab). Without the column the local env hit "WordPress database error: Unknown column 'stats.has_pending' in 'WHERE'" the moment a locale page issued one of those queries. Mirror the new schema in extra-tables.sql (bigint id, has_pending, compound locale index, date_added/date_modified indexes, drop the single-column indexes on the count fields) and teach both stats writers (after-start.sh, import-wp-core.php) to populate has_pending so the new index actually points at the right rows.
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Summary
wp_gp_project_translation_statusschema with production commit733b8ab: add denormalizedhas_pending tinyint+ compound indexlocale(locale, locale_slug, has_pending), drop the now-redundant single-column count indexes, bumpidtobigint. Without it locale pages hitWordPress database error: Unknown column 'stats.has_pending' in 'WHERE'the moment a "needs attention" query runs.after-start.shrebuild loop,import-wp-core.phppost-import refresh) to populatehas_pending = (waiting > 0 OR fuzzy > 0)and include it in theON DUPLICATE KEY UPDATEclause, so the new index actually points at the right rows.Production maintains the table manually (no migration code in the plugin) — same approach as the existing extra-tables.sql.
Test plan
wp-env destroy && wp-env start— fresh table created with the new column and indexes;DESCRIBEmatches the production shape.ALTER TABLE+ backfill on an existing env — exactly the rows wherewaiting > 0 OR fuzzy > 0flipped tohas_pending = 1(49 of 107).curl /locale/en-gb/default/→ HTTP 200, no DB error in the response.vendor/bin/phpcs environments/translate/bin/import-wp-core.php -snq).