Search in sources :

Example 81 with ValidationErrors

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

the class AddPrimaryKeyGenerator method validate.

@Override
public ValidationErrors validate(AddPrimaryKeyStatement addPrimaryKeyStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("columnNames", addPrimaryKeyStatement.getColumnNames());
    validationErrors.checkRequiredField("tableName", addPrimaryKeyStatement.getTableName());
    if (!(database instanceof MSSQLDatabase || database instanceof MockDatabase)) {
        if (addPrimaryKeyStatement.isClustered() != null && !addPrimaryKeyStatement.isClustered()) {
            validationErrors.checkDisallowedField("clustered", addPrimaryKeyStatement.isClustered(), database);
        }
    }
    if (!(database instanceof OracleDatabase || database instanceof DB2Database)) {
        validationErrors.checkDisallowedField("forIndexName", addPrimaryKeyStatement.getForIndexName(), database);
    }
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors) MockDatabase(liquibase.sdk.database.MockDatabase)

Example 82 with ValidationErrors

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

the class CommentGenerator method validate.

@Override
public ValidationErrors validate(CommentStatement comment, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("text", comment.getText());
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 83 with 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;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 84 with ValidationErrors

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

the class CreateIndexGenerator method validate.

@Override
public ValidationErrors validate(CreateIndexStatement createIndexStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tableName", createIndexStatement.getTableName());
    validationErrors.checkRequiredField("columns", createIndexStatement.getColumns());
    if (database instanceof HsqlDatabase) {
        validationErrors.checkRequiredField("name", createIndexStatement.getIndexName());
    }
    return validationErrors;
}
Also used : ValidationErrors(liquibase.exception.ValidationErrors)

Example 85 with ValidationErrors

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

the class AddAutoIncrementGenerator 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());
    validationErrors.checkRequiredField("columnDataType", statement.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