use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class AddForeignKeyConstraintGenerator method validate.
@Override
public ValidationErrors validate(AddForeignKeyConstraintStatement addForeignKeyConstraintStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
if ((addForeignKeyConstraintStatement.isInitiallyDeferred() || addForeignKeyConstraintStatement.isDeferrable()) && !database.supportsInitiallyDeferrableColumns()) {
validationErrors.checkDisallowedField("initiallyDeferred", addForeignKeyConstraintStatement.isInitiallyDeferred(), database);
validationErrors.checkDisallowedField("deferrable", addForeignKeyConstraintStatement.isDeferrable(), database);
}
validationErrors.checkRequiredField("baseColumnNames", addForeignKeyConstraintStatement.getBaseColumnNames());
validationErrors.checkRequiredField("baseTableNames", addForeignKeyConstraintStatement.getBaseTableName());
validationErrors.checkRequiredField("referencedColumnNames", addForeignKeyConstraintStatement.getReferencedColumnNames());
validationErrors.checkRequiredField("referencedTableName", addForeignKeyConstraintStatement.getReferencedTableName());
validationErrors.checkRequiredField("constraintName", addForeignKeyConstraintStatement.getConstraintName());
validationErrors.checkDisallowedField("onDelete", addForeignKeyConstraintStatement.getOnDelete(), database, SybaseDatabase.class);
return validationErrors;
}
use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class CopyRowsGenerator method validate.
@Override
public ValidationErrors validate(CopyRowsStatement copyRowsStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("targetTable", copyRowsStatement.getTargetTable());
validationErrors.checkRequiredField("sourceTable", copyRowsStatement.getSourceTable());
validationErrors.checkRequiredField("copyColumns", copyRowsStatement.getCopyColumns());
return validationErrors;
}
use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class AddAutoIncrementGeneratorDB2 method validate.
@Override
public ValidationErrors validate(AddAutoIncrementStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("columnName", statement.getColumnName());
validationErrors.checkRequiredField("tableName", statement.getTableName());
return validationErrors;
}
use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class AddAutoIncrementGeneratorInformix method validate.
@Override
public ValidationErrors validate(AddAutoIncrementStatement addAutoIncrementStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = super.validate(addAutoIncrementStatement, database, sqlGeneratorChain);
validationErrors.checkRequiredField("columnDataType", addAutoIncrementStatement.getColumnDataType());
return validationErrors;
}
use of liquibase.exception.ValidationErrors in project liquibase by liquibase.
the class SqlGeneratorChainTest method validate_twoGenerators_secondHasErrors.
@Test
public void validate_twoGenerators_secondHasErrors() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
generators.add(new MockSqlGenerator(2, "B1", "B2"));
generators.add(new MockSqlGenerator(1, "A1", "A2").addValidationError("E1"));
SqlGeneratorChain chain = new SqlGeneratorChain(generators);
ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
assertTrue(validationErrors.hasErrors());
}
Aggregations