How to create unique constraint for 2 columns in JDL-Studio?

前端 未结 3 427
走了就别回头了
走了就别回头了 2021-02-05 22:07

I have following entity configuration:

entity AirplaneModelSeat { 
    id Long, 
    seatNo String required 
}
relationship ManyToOne   { 
    AirplaneModelSeat{         


        
3条回答
  •  野性不改
    2021-02-05 22:43

    In addition to Oerd's answer ^_^ In addition to the Liquibase configuration in David's answer I suggest you also add the relevant JPA annotations to your Entity.

    If only To ensure a field value is unique you can write

    @Column(unique=true)
    String username;
    

    The @UniqueConstraint annotation is for annotating multiple unique keys at the table level.

    And also for Liquibase configuration, iff only To ensure a field value is unique you can write

      
         
      
    

提交回复
热议问题