Search in sources :

Example 51 with ValidationErrors

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

the class CreateTableGenerator method validate.

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

Example 52 with ValidationErrors

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

the class CreateViewGenerator method validate.

@Override
public ValidationErrors validate(CreateViewStatement createViewStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    if (database instanceof InformixDatabase) {
        return new CreateViewGeneratorInformix().validate(createViewStatement, database, sqlGeneratorChain);
    }
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("viewName", createViewStatement.getViewName());
    validationErrors.checkRequiredField("selectQuery", createViewStatement.getSelectQuery());
    if (createViewStatement.isReplaceIfExists()) {
        validationErrors.checkDisallowedField("replaceIfExists", createViewStatement.isReplaceIfExists(), database, HsqlDatabase.class, DB2Database.class, DerbyDatabase.class, SybaseASADatabase.class, InformixDatabase.class);
    }
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 53 with ValidationErrors

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

the class CreateViewGeneratorInformix method validate.

@Override
public ValidationErrors validate(CreateViewStatement createViewStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("viewName", createViewStatement.getViewName());
    validationErrors.checkRequiredField("selectQuery", createViewStatement.getSelectQuery());
    if (createViewStatement.isReplaceIfExists()) {
        validationErrors.checkDisallowedField("replaceIfExists", createViewStatement.isReplaceIfExists(), database, HsqlDatabase.class, H2Database.class, DB2Database.class, MSSQLDatabase.class, DerbyDatabase.class, SybaseASADatabase.class, InformixDatabase.class);
    }
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 54 with ValidationErrors

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

the class DeleteGenerator method validate.

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

Example 55 with ValidationErrors

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

the class FindForeignKeyConstraintsGeneratorHsql method validate.

public ValidationErrors validate(FindForeignKeyConstraintsStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("baseTableName", statement.getBaseTableName());
    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