Skip to content

Commit

Permalink
feat: allow indexSpecification to override index name
Browse files Browse the repository at this point in the history
  • Loading branch information
Rmannn committed Oct 14, 2020
1 parent bf5925a commit 724b22f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/indexes/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export async function createIndexes<Model extends EntityInterface>(
const indexName = `${ModelClass.name}_${property}_relationship`;
if (typeof rel.indexSpecification === 'object') {
indexes.push({
...rel.indexSpecification,
name: indexName
name: indexName,
...rel.indexSpecification
});
} else if (rel.indexSpecification !== false) {
indexes.push({
key: { [property]: 1 },
name: indexName
name: indexName,
key: { [property]: 1 }
});
}
}
Expand Down

0 comments on commit 724b22f

Please sign in to comment.