简体   繁体   中英

How to add index to many-to-many relationship in TypeORM

When I add a many-to-many relationship in typeORM entities, how can I add index to the relation columns?

@Entity()
export class Tag {
  @Column()
  id: number

  //@Index() does not work here...
  @ManyToMany(() => Todo, (todo) => todo.tags)
  todos: Todo[];

......

Turns out the indices are add automatically. Then I have to ask how can I tell typeORM not to add the index since it may not be needed..... 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM