I have one entity in room
@Entity(foreignKeys ={ @ForeignKey(entity = Label.class, parentColumns = \"_id\", childColumns = \"labelId\", onDelete = CA
If you wonder to make a single column to be unique, only need to write
@Entity(indices = [Index(value = ["name"], unique = true)])