📅  最后修改于: 2022-03-11 14:48:36.198000             🧑  作者: Mango
@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;
}