We're updating the issue view to help you get more done. 

Adding unique constraint to a field from an entity with an already existing database table does not work despite content being unique

Description

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

I'd consider this bug critical since it fails silently and therefore leads to database corruption. The test data I used was unique therefore there should have been no reason for not applying the unique constraint

 

The issue happens on an already existing table, however, after doublechecking, the content of the database was containing only unique entries, therefore it should have been possible to apply the constraint.

Environment

Ubuntu LTS 18.4.2, Percona MySQL 8.0.15

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.3

Priority

Critical