I am creating a link table that has 3 columns; id, product_id, tournament_id.
Adding a unique constant to the id column is trivial, but I want to make sure that any pair (product_id, tournament_id) is unique.
Liquibase.org example shows
<changeSet author="liquibase-docs" id="addUniqueConstraint-example"> <addUniqueConstraint catalogName="cat" columnNames="id, name" constraintName="const_name" deferrable="true" disabled="true" initiallyDeferred="true" schemaName="public" tableName="person" tablespace="A String"/> </changeSet>
but is it possible to do this in a <createTable> block?
Also, just for confirmation; Does this create a composite unique constraint in two columns or create two separate unique constraints?
unique-constraint liquibase
Alec
source share