fix(2meet-data-optimizer-hivepress-addon): declare the listing indexes only on a core that adds them outside web requests

- the hp_listing_core indexes are declared only when TMDO_Schema_Manager has
  ddl_allowed() (core 1.3.0+); core 1.2.0 would run the ALTER on 900k rows
  inside the first request after deploy, a visitor's included, if this AddOn
  were deployed first
- Verify: unit 145, integration 53, phpcs
- PR: PR-090b (found while writing the 0.4.0 notes)
This commit is contained in:
2026-09-27 16:50:01 +08:00
parent d129139c7d
commit b2585459e3
@@ -262,10 +262,12 @@ final class TMDO_HivePress_Entity_Groups {
// Filtered and sorted on by HivePress search. Declared as indexes // Filtered and sorted on by HivePress search. Declared as indexes
// (added in place) rather than `searchable`, which would change // (added in place) rather than `searchable`, which would change
// the schema hash and rebuild a table that may hold aeav_only data. // the schema hash and rebuild a table that may hold aeav_only data.
'indexes' => array( // Only with core 1.3.0+ (ddl_allowed()): older cores run the ALTER
// inside whatever request comes first, a visitor's included.
'indexes' => method_exists( 'TMDO_Schema_Manager', 'ddl_allowed' ) ? array(
'hourly_rate' => array( 'hp_hourly_rate' ), 'hourly_rate' => array( 'hp_hourly_rate' ),
'rating_count' => array( 'hp_rating_count' ), 'rating_count' => array( 'hp_rating_count' ),
), ) : array(),
) )
); );
} }