ensureQueryIndex method
Creates a small partial index for fieldPath in table: it covers only
that field's live rows and indexes their extracted value, so an equality
predicate on the path is an index search rather than a table scan.
Implementation
@override
Future<void> ensureQueryIndex(String table, String fieldPath) async {
_open.execute(
'CREATE INDEX IF NOT EXISTS ${_indexName(table, fieldPath)} '
"ON crdt_records (json_extract(value, '\$'), doc_id) "
'WHERE collection = ${_lit(table)} AND field_path = ${_lit(fieldPath)} '
'AND is_deleted = 0',
);
}