All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.ext.cachedb.sqlgenerator.AddColumnGeneratorCache Maven / Gradle / Ivy

There is a newer version: 4.30.0
Show newest version
package liquibase.ext.cachedb.sqlgenerator;

import liquibase.database.Database;
import liquibase.exception.ValidationErrors;
import liquibase.ext.cachedb.database.CacheDatabase;
import liquibase.sqlgenerator.SqlGeneratorChain;
import liquibase.sqlgenerator.core.AddColumnGenerator;
import liquibase.statement.core.AddColumnStatement;

public class AddColumnGeneratorCache extends AddColumnGenerator {
    @Override
    public int getPriority() {
        return PRIORITY_DATABASE;
    }

    @Override
    public boolean supports(AddColumnStatement statement, Database database) {
        return database instanceof CacheDatabase;
    }

    @Override
    public ValidationErrors validate(AddColumnStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
        ValidationErrors errors = super.validate(statement, database, sqlGeneratorChain);
        if (statement.isPrimaryKey()) {
            errors.addError("Cannot add a primary key column");
        }
        return errors;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy