I want to add a unique constraint to a column using Liquibase. Of course I want to check if duplicate rows exist using a precondition.
I came up this:
<preConditions>
<sqlCheck expectedResult="0">
select count(*)
from person
having ( count(username) > 1 )
</sqlCheck>
</preConditions>
However this produces Empty set
on MySQL and probably other databases.
I tried using expectedResult=""
and expectedResult="null"
but both don't work.