Search in sources :

Example 26 with ValidationErrors

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

the class TableRowCountGenerator method validate.

@Override
public ValidationErrors validate(TableRowCountStatement dropColumnStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tableName", dropColumnStatement.getTableName());
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 27 with ValidationErrors

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

the class TagDatabaseGenerator method validate.

@Override
public ValidationErrors validate(TagDatabaseStatement tagDatabaseStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tag", tagDatabaseStatement.getTag());
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 28 with ValidationErrors

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

the class UpdateGenerator method validate.

@Override
public ValidationErrors validate(UpdateStatement updateStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tableName", updateStatement.getTableName());
    validationErrors.checkRequiredField("columns", updateStatement.getNewColumnValues());
    if (updateStatement.getWhereParameters() != null && updateStatement.getWhereParameters().size() > 0 && updateStatement.getWhereClause() == null) {
        validationErrors.addError("whereParams set but no whereClause");
    }
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 29 with ValidationErrors

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

the class ReindexGeneratorSQLite method validate.

@Override
public ValidationErrors validate(ReindexStatement reindexStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tableName", reindexStatement.getTableName());
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 30 with ValidationErrors

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

the class RenameColumnGenerator method validate.

@Override
public ValidationErrors validate(RenameColumnStatement renameColumnStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tableName", renameColumnStatement.getTableName());
    validationErrors.checkRequiredField("oldColumnName", renameColumnStatement.getOldColumnName());
    validationErrors.checkRequiredField("newColumnName", renameColumnStatement.getNewColumnName());
    if (database instanceof MySQLDatabase) {
        validationErrors.checkRequiredField("columnDataType", StringUtils.trimToNull(renameColumnStatement.getColumnDataType()));
    }
    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