Coverage Report - liquibase.sqlgenerator.core.RemoveChangeSetRanStatusGenerator
 
Classes in this File Line Coverage Branch Coverage Complexity
RemoveChangeSetRanStatusGenerator
16%
1/6
N/A
1
 
 1  
 package liquibase.sqlgenerator.core;
 2  
 
 3  
 import liquibase.changelog.ChangeSet;
 4  
 import liquibase.database.Database;
 5  
 import liquibase.exception.ValidationErrors;
 6  
 import liquibase.sql.Sql;
 7  
 import liquibase.sqlgenerator.SqlGenerator;
 8  
 import liquibase.sqlgenerator.SqlGeneratorChain;
 9  
 import liquibase.sqlgenerator.SqlGeneratorFactory;
 10  
 import liquibase.statement.core.DeleteStatement;
 11  
 import liquibase.statement.core.RemoveChangeSetRanStatusStatement;
 12  
 
 13  10
 public class RemoveChangeSetRanStatusGenerator extends AbstractSqlGenerator<RemoveChangeSetRanStatusStatement> {
 14  
 
 15  
     public ValidationErrors validate(RemoveChangeSetRanStatusStatement statement, Database database,
 16  
             SqlGeneratorChain sqlGeneratorChain) {
 17  0
         ValidationErrors errors = new ValidationErrors();
 18  0
         errors.checkRequiredField("changeSet", statement.getChangeSet());
 19  0
         return errors;
 20  
     }
 21  
 
 22  
     public Sql[] generateSql(RemoveChangeSetRanStatusStatement statement, Database database,
 23  
             SqlGeneratorChain sqlGeneratorChain) {
 24  0
         ChangeSet changeSet = statement.getChangeSet();
 25  
 
 26  0
         return SqlGeneratorFactory.getInstance().generateSql(
 27  
                 new DeleteStatement(database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName())
 28  
                         .setWhereClause("ID=? AND AUTHOR=? AND FILENAME=?").addWhereParameters(changeSet.getId(),
 29  
                                 changeSet.getAuthor(), changeSet.getFilePath()), database);
 30  
     }
 31  
 }