use of liquibase.statement.core.AddPrimaryKeyStatement in project liquibase by liquibase.
the class AddPrimaryKeyChange method generateStatements.
@Override
public SqlStatement[] generateStatements(Database database) {
boolean shouldValidate = true;
if (getValidate() != null) {
shouldValidate = getValidate();
}
AddPrimaryKeyStatement statement = new AddPrimaryKeyStatement(getCatalogName(), getSchemaName(), getTableName(), ColumnConfig.arrayFromNames(getColumnNames()), getConstraintName());
statement.setTablespace(getTablespace());
statement.setClustered(getClustered());
statement.setForIndexName(getForIndexName());
statement.setForIndexSchemaName(getForIndexSchemaName());
statement.setForIndexCatalogName(getForIndexCatalogName());
statement.setShouldValidate(shouldValidate);
if (database instanceof DB2Database) {
return new SqlStatement[] { statement, new ReorganizeTableStatement(getCatalogName(), getSchemaName(), getTableName()) };
}
return new SqlStatement[] { statement };
}
Aggregations