duplicatedIndexes property
The indexes over the same columns (in the same order, case
insensitive) and of the same kind (indexesKinds): each group's names
sorted, the groups by their first name. null if the indexes are
unknown.
Implementation
List<List<String>>? get duplicatedIndexes {
var indexes = this.indexes;
if (indexes == null) return null;
var byColumns = <String, List<String>>{};
for (var e in indexes.entries) {
var columns = e.value.map((c) => c.toLowerCase()).join(',');
var key = '$columns|${indexesKinds?[e.key] ?? ''}';
byColumns.putIfAbsent(key, () => <String>[]).add(e.key);
}
return byColumns.values
.where((names) => names.length > 1)
.map((names) => names..sort())
.sortedBy((names) => names.first);
}