indexes
One-time index builds for the pod background cache.
metadata.create_all builds a table's indexes only at the moment it creates
the table, so a cache that predates an index the ORM now declares never gains
it on open. Each module here creates one such index in place, so an existing
pod converges on the same physical layout a fresh cache gets from its ORM.
These sit apart from the data migrations alongside them (which rewrite stored
values) because they share a shape: derive the DDL from the ORM object rather
than re-spelling it, check for presence first, and use IF NOT EXISTS so two
processes opening the same cache cannot race each other into a hard failure.
Registered in cache.migrations._MIGRATIONS like any other one-time migration,
except where an index's upkeep outlives its build — the patient search index
keeps triggers on another table, so it is registered in _RECONCILED and
re-checked on every open instead. See that tuple's comment.
Module
Submodules
- bitfount.cache.migrations.indexes.create_patient_eligibility_trial_index - Add the
eligible_trialsfilter index to caches created before it existed. - bitfount.cache.migrations.indexes.create_patients_name_order_index - Add the patient-list ordering index to caches created before it existed.
- bitfount.cache.migrations.indexes.create_patients_search_index - Build the FTS5 trigram index that serves patient-list search.