Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1030153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:39:17+00:00 2026-05-16T12:39:17+00:00

We use liquibase to keep track of our database changes.. First changeSet contains those

  • 0

We use liquibase to keep track of our database changes..
First changeSet contains those lines:

<column name="SHORT_ID" type="INTEGER">
   <constraints unique="true" />
</column>

Basically it means that SHORT_ID column has unique constraint but the name of this constraint can be whatever and usually is different each time (we run some integration tests against H2 databases and new bases are made each time we run tests)

So.. problem is: I can’t change this first changeSet but now we have to get rid of this unique constraint. Any ideas how to achieve that by using liquibase?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:39:18+00:00Added an answer on May 16, 2026 at 12:39 pm

    H2’s SQL for dropping constraints requires a constraint name. I don’t remember if the auto-generated constraint name in H2 is random or would be consistent across databases.

    If it’s constant, you can use the normal liquibase tag and it will work fine.

    If it’s random, you will have to get the constraint name from the information_schema. H2 may allow something like:

    alter table TABLE_NAME drop constraint 
          (select unique_index_name 
                  from information_schema.constraints 
                  where table_name='TABLE_NAME' and column_name='SHORT_ID')
    

    If not, you may need to create a custom liquibase change (http://liquibase.org/extensions with 2.0, http://www.liquibase.org/manual/custom_refactoring_class in 1.9) that makes the call and drops the constraint.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an open source Java database migration tool ( http://www.liquibase.org ) which I
I'm performing a diff on a remote mysql database using LiquiBase, and finding that
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
Use case: A does something on his box and gots stuck. He asks B
Use case: 3rd party application wants to programatically monitor a text file being generated
We use a data acquisition card to take readings from a device that increases
I use Firebug and the Mozilla JS console heavily, but every now and then
I use rsync to synchronize files to Windows clients in a server agnostic way.
I use emacs to edit my xml files (nxml-mode) and the files were generated
I use the VS2008 command prompt for builds, TFS access etc. and the cygwin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.