<dropUniqueConstraint/> without specifying name

Hello,

I created a unique field using liquibase like this:

       

Now I would like to name the unique constraint. I naively tried this approach:

           

But I got following exception:

    Caused by: liquibase.exception.ValidationFailedException: Validation Failed:     1 changes have validation failures           liquibase.exception.InvalidChangeDefinitionException: dropUniqueConstraint in 'liquibase/1.0/dbn-8-10-2009.xml::18::dbn' is invalid: constraintName is required

I would really like to know how to add a name to existing constraint or drop a constraint without a name (well with a generated one). Did I “shoot myself in the leg” by not naming the constraints in the first place?
I am running the script against multiple databases and constraint gets called differently so it’s not practical for me to use tag.

Thanks for any tip or hints.

Dalibor

Unfortunately without a constraint name, there is no way to create drop them in an automatic, cross-database manner.  Many databases don’t even let you drop a constraint without a name.

With a pre-existing mysql database, I had to write a stored procedure that would query the information_schema table to find the name and drop it. 

Your best bet is probably to create a custom change (http://www.liquibase.org/manual/custom_refactoring_class or http://liquibase.jira.com/wiki/display/CONTRIB/Overview) that will inspect your database at runtime to determine the constraint name, then return the correct SQL to drop it.

Nathan