feat: replace event datetime postmeta with dedicated event_dates table#153
Merged
feat: replace event datetime postmeta with dedicated event_dates table#153
Conversation
Replace _datamachine_event_datetime and _datamachine_event_end_datetime postmeta with a new datamachine_event_dates table (post_id PK, start_datetime, end_datetime). This eliminates expensive postmeta JOINs across all event queries — upcoming count drops from 3-9s to 7ms on 37K events. - New EventDatesTable class with schema, upsert, get, delete, backfill - Write path: meta-storage.php uses EventDatesTable::upsert() instead of update_post_meta - New datamachine_event_dates_updated action replaces updated_post_meta hooks - datamachine_get_event_dates() global helper for single-post reads - DateFilter rewritten: posts_clauses filters + parameterless SQL fragment methods - EventQueryBuilder returns cleanup callable to prevent filter leaks - All 17 meta_query locations switched to posts_clauses filters - All 11 raw SQL locations switched from postmeta JOINs to event_dates JOINs - All 23 get_post_meta reads switched to EventDatesTable::get() - EventIdentityWriter hooks new datamachine_event_dates_updated action - CLI backfill command: wp datamachine-events backfill-event-dates - Table created on plugin activation via dbDelta
Contributor
Homeboy Results —
|
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
Replace
_datamachine_event_datetimeand_datamachine_event_end_datetimepostmeta with a dedicateddatamachine_event_datestable. Clean cut — no postmeta fallback.Performance
What's New
EventDatesTableclass — schema viadbDelta(),upsert(),get(),delete(),backfill()datamachine_get_event_dates()global helper for single-post readsdatamachine_event_dates_updatedaction — replacesupdated_post_meta/added_post_metahookswp datamachine-events backfill-event-datesMigration Scope
EventDatesTable.phpmeta-storage.php,CheckMetaSyncCommand.phpEventDatesTable::get()EventIdentityWriterhooks new actionBackfill
Already run on production (37,294 events). Table verified with sample queries.
Cross-repo PRs