Answers for "typeorm @unique"

0

typeorm @unique

@Entity()
@Unique(["field1"]) // one field
@Unique("index_name", ["field1", "field2"]) // named; multiple fields
export class MyEntity {
  @PrimaryGeneratedColumn('uuid')
  id: string;
  
  @Column()
  field1: string;
  
  @Column()
  field2: string;
}
Posted by: Guest on January-04-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language