
com.whiteclarkegroup.liquibaselinter.config.rules.specific.ModifyDataEnforceWhere Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-linter Show documentation
Show all versions of liquibase-linter Show documentation
Liquibase extension to add configurable script linting
package com.whiteclarkegroup.liquibaselinter.config.rules.specific;
import com.whiteclarkegroup.liquibaselinter.config.rules.Rule;
import com.whiteclarkegroup.liquibaselinter.config.rules.RuleConfig;
import com.whiteclarkegroup.liquibaselinter.config.rules.WithFormattedErrorMessage;
import liquibase.change.Change;
import liquibase.change.core.AbstractModifyDataChange;
public class ModifyDataEnforceWhere extends Rule implements WithFormattedErrorMessage {
public ModifyDataEnforceWhere(RuleConfig ruleConfig) {
super(ruleConfig);
}
@Override
public boolean invalid(AbstractModifyDataChange modifyDataChange, Change change) {
return getRuleConfig().getValues().contains(modifyDataChange.getTableName()) && (modifyDataChange.getWhere() == null || modifyDataChange.getWhere().isEmpty());
}
@Override
public String formatErrorMessage(String errorMessage, AbstractModifyDataChange modifyDataChange) {
return String.format(errorMessage, modifyDataChange.getTableName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy