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

Method processIndex

packages/entity-generator/src/SourceFile.ts:765–781  ·  view source on GitHub ↗
(type: 'index' | 'unique')

Source from the content-addressed store, hash-verified

763
764 protected getPropertyIndexes(prop: EntityProperty, options: Dictionary): string[] {
765 const processIndex = (type: 'index' | 'unique') => {
766 const propType = prop[type];
767 if (!propType) {
768 return;
769 }
770
771 const defaultName = this.platform.getIndexName(this.meta.collection, prop.fieldNames, type);
772 options[type] = propType === true || defaultName === propType ? 'true' : this.quote(propType);
773 const expected = {
774 index: this.platform.indexForeignKeys(),
775 unique: prop.kind === ReferenceKind.ONE_TO_ONE,
776 };
777
778 if (expected[type] && options[type] === 'true') {
779 delete options[type];
780 }
781 };
782
783 processIndex('index');
784 processIndex('unique');

Callers

nothing calls this directly

Calls 3

quoteMethod · 0.95
getIndexNameMethod · 0.45
indexForeignKeysMethod · 0.45

Tested by

no test coverage detected