final String sqlTemplate = "ALTER TABLE %s ADD CONSTRAINT %s UNIQUE (%s)";
final String sqlNoContraintNameTemplate = "ALTER TABLE %s ADD UNIQUE (%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.escapeConstraintName(statement.getConstraintName())
, database.escapeColumnNameList(statement.getColumnNames())
), getAffectedUniqueConstraint(statement))
};