Is there a good/easy way to rename primary keys and/or indexes?

I’m switching from having Hibernate generate the schema to having Liquibase take care of things.  We have three “beta” releases out in the wild and would like to be able to upgrade from any of those to the latest.  However, it seems things changed a little bit from release to release: a primary key went from INTEG_01 in the first beta to INTEG_02 in the second, & INTEG_03 in the third.  Same type of thing for some indexes.

I do not see any sort of “rename” refactoring for these two scenarios.  Doing it “manually” is basically going to require me to drop the entire Beta 1 schema as the first part of the Beta 2 delta schema, etc.  Yuck!

Any hints would be greatly appreciated.


Unfortunately the only SQL syntax for dropping indexes and keys is to use the name.  What I have done in the past is write a custom change class ( that queries the information_schema or jdbc metadata to find the name of the index for the table and/or columns passed in and then runs the correct drop SQL. 

The core liquibase library does not support this because we do not want to rely on metadata being available at runtime because we need to support updateSQL mode.  If you are doing standard updates, however, this approach will work just fine.