Search in sources :

Example 41 with ValidationErrors

use of liquibase.exception.ValidationErrors in project liquibase by liquibase.

the class SetNullableGenerator method validate.

@Override
public ValidationErrors validate(SetNullableStatement setNullableStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tableName", setNullableStatement.getTableName());
    validationErrors.checkRequiredField("columnName", setNullableStatement.getColumnName());
    if (database instanceof MSSQLDatabase || database instanceof MySQLDatabase || database instanceof InformixDatabase || database instanceof H2Database) {
        validationErrors.checkRequiredField("columnDataType", setNullableStatement.getColumnDataType());
    }
    try {
        if ((database instanceof DB2Database) && (database.getDatabaseMajorVersion() > 0 && database.getDatabaseMajorVersion() < 9)) {
            validationErrors.addError("DB2 versions less than 9 do not support modifying null constraints");
        }
    } catch (DatabaseException ignore) {
    //cannot check
    }
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors) DatabaseException(liquibase.exception.DatabaseException)

Example 42 with ValidationErrors

use of liquibase.exception.ValidationErrors in project liquibase by liquibase.

the class StoredProcedureGenerator method validate.

@Override
public ValidationErrors validate(StoredProcedureStatement storedProcedureStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("procedureName", storedProcedureStatement.getProcedureName());
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 43 with ValidationErrors

use of liquibase.exception.ValidationErrors in project liquibase by liquibase.

the class UpdateChangeSetChecksumGenerator method validate.

@Override
public ValidationErrors validate(UpdateChangeSetChecksumStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("changeSet", statement.getChangeSet());
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 44 with ValidationErrors

use of liquibase.exception.ValidationErrors in project liquibase by liquibase.

the class RemoveChangeSetRanStatusGenerator method validate.

@Override
public ValidationErrors validate(RemoveChangeSetRanStatusStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors errors = new ValidationErrors();
    errors.checkRequiredField("changeSet", statement.getChangeSet());
    return errors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 45 with ValidationErrors

use of liquibase.exception.ValidationErrors in project liquibase by liquibase.

the class RenameSequenceGenerator method validate.

@Override
public ValidationErrors validate(RenameSequenceStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("newSequenceName", statement.getNewSequenceName());
    validationErrors.checkRequiredField("oldSequenceName", statement.getOldSequenceName());
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Aggregations

ValidationErrors (liquibase.exception.ValidationErrors)89 Test (org.junit.Test)11 MockDatabase (liquibase.sdk.database.MockDatabase)9 Database (liquibase.database.Database)6 MockSqlStatement (liquibase.statement.core.MockSqlStatement)6 TreeSet (java.util.TreeSet)5 ArrayList (java.util.ArrayList)2 Change (liquibase.change.Change)2 ChangeFactory (liquibase.change.ChangeFactory)2 ChangeMetaData (liquibase.change.ChangeMetaData)2 ChangeParameterMetaData (liquibase.change.ChangeParameterMetaData)2 CreateTableChange (liquibase.change.core.CreateTableChange)2 DatabaseChangeLog (liquibase.changelog.DatabaseChangeLog)2 RanChangeSet (liquibase.changelog.RanChangeSet)2 UnexpectedLiquibaseException (liquibase.exception.UnexpectedLiquibaseException)2 SqlStatement (liquibase.statement.SqlStatement)2 AddColumnStatement (liquibase.statement.core.AddColumnStatement)2 JUnitResourceAccessor (liquibase.test.JUnitResourceAccessor)2 AbstractVerifyTest (liquibase.verify.AbstractVerifyTest)2 Ignore (org.junit.Ignore)2