MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / diffIndex

Method diffIndex

packages/sql/src/schema/SchemaComparator.ts:986–994  ·  view source on GitHub ↗

* Finds the difference between the indexes index1 and index2. * Compares index1 with index2 and returns index2 if there are any differences or false in case there are no differences.

(index1: IndexDef, index2: IndexDef)

Source from the content-addressed store, hash-verified

984 * Compares index1 with index2 and returns index2 if there are any differences or false in case there are no differences.
985 */
986 diffIndex(index1: IndexDef, index2: IndexDef): boolean {
987 // Opaque raw expressions (`expression` escape hatch) and full-text indexes can't be
988 // compared structurally — fall back to name-only matching.
989 if (index1.expression || index2.expression || index1.type === 'fulltext' || index2.type === 'fulltext') {
990 return index1.keyName !== index2.keyName;
991 }
992
993 return !this.isIndexFulfilledBy(index1, index2) || !this.isIndexFulfilledBy(index2, index1);
994 }
995
996 /**
997 * Checks if the other index already fulfills all the indexing and constraint needs of the current one.

Callers 2

diffTableMethod · 0.95
detectIndexRenamingsMethod · 0.95

Calls 1

isIndexFulfilledByMethod · 0.95

Tested by

no test coverage detected