This is what my column looks like
<column name="name" type="VARCHAR(255)">
<constraints nullable="false" unique="true"/>
</column>
I want to remove unique=true
constraint.
I looked at what liquibase has to offer and it has
<changeSet author="liquibase-docs" id="dropUniqueConstraint-example">
<dropUniqueConstraint catalogName="cat"
constraintName="const_name"
schemaName="public"
tableName="person"
uniqueColumns="A String"/>
</changeSet>
Now since constraintName
is required and I do not have it, what are my options?
How can I drop unique=true
using liquibase?
I ended up creating a new column to replace the column that has the unique constraint.
<addColumn tableName="TABLE" schemaName="SCHEMA">
<column name="NEW_COLUMN" type="TYPE" valueComputed="OLD_COLUMN"></column>
</addColumn>
<dropColumn tableName="TABLE" schemaName="SCHEMA" columnName="OLD_COLUMN"/>
<renameColumn tableName="TABLE" schemaName="SCHEMA" oldColumnName="NEW_COLUMN" newColumnName="OLD_COLUMN"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With