Unique constraints fail to apply if at least one contains non unique elements

Description

Applying @Column(unique = true) doesn't lead to an unique constraint being created at database level.

The scenario happens when adding an unique constraint on multiple fields individually and one of them does not have unique fields. This leads to potential silent data corruption and a constant need to doublecheck the application since due to it’s not reported at all at application level.

 

Environment

Ubuntu LTS 18.4.2, Percona MySQL 8.0.16

Status

Assignee

Unassigned

Reporter

Sergiu Hlihor

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.4.4

Priority

Critical
Configure