hasIndex method
Determines if the given table has a specific index. Optionally check by index type ('primary', 'unique', or specific driver type).
Implementation
@override
Future<bool> hasIndex(
String table,
String index, {
String? schema,
String? type,
}) async {
return snapshot.indexes.any((idx) {
final typeMatches =
type == null ||
(type == 'primary' && idx.primary) ||
(type == 'unique' && idx.unique) ||
_equals(type, idx.type);
return _equalsOwner(idx.schema, schema) &&
_equals(idx.tableName, table) &&
_equals(idx.name, index) &&
typeMatches;
});
}