liquibase.statement.UniqueConstraint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
package liquibase.statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class UniqueConstraint implements ColumnConstraint {
private String constraintName;
/**
* Default value is true
*/
private boolean validateUnique = true;
private List columns = new ArrayList<>();
public UniqueConstraint() {
}
public UniqueConstraint(String constraintName) {
this.constraintName = constraintName;
}
public UniqueConstraint(String constraintName, boolean validateUnique) {
this.constraintName = constraintName;
setValidateUnique(validateUnique);
}
public UniqueConstraint addColumns(String... columns) {
this.columns.addAll(Arrays.asList(columns));
return this;
}
public String getConstraintName() {
return constraintName;
}
public void setConstraintName(String constraintName) {
this.constraintName = constraintName;
}
public List getColumns() {
return columns;
}
public boolean shouldValidateUnique() {
return validateUnique;
}
public void setValidateUnique(boolean validateUnique) {
this.validateUnique = validateUnique;
}
}