final String sqlNoContraintNameTemplate = "ALTER TABLE %s ADD CONSTRAINT UNIQUE (%s)";
final String sqlTemplate = "ALTER TABLE %s ADD CONSTRAINT UNIQUE (%s) CONSTRAINT %s";
if (statement.getConstraintName() == null) {
return new Sql[] {
new UnparsedSql(String.format(sqlNoContraintNameTemplate
, database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName())
, database.escapeColumnNameList(statement.getColumnNames())
), getAffectedUniqueConstraint(statement))
};
} else {
return new Sql[] {
new UnparsedSql(String.format(sqlTemplate
, database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName())
, database.escapeColumnNameList(statement.getColumnNames())
, database.escapeConstraintName(statement.getConstraintName())
), getAffectedUniqueConstraint(statement))
};