Coverage Report - liquibase.change.core.DeleteDataChange
 
Classes in this File Line Coverage Branch Coverage Complexity
DeleteDataChange
13%
2/15
0%
0/2
1.111
 
 1  
 package liquibase.change.core;
 2  
 
 3  
 import liquibase.change.AbstractChange;
 4  
 import liquibase.change.ChangeMetaData;
 5  
 import liquibase.change.TextNode;
 6  
 import liquibase.database.Database;
 7  
 import liquibase.statement.SqlStatement;
 8  
 import liquibase.statement.core.DeleteStatement;
 9  
 import liquibase.util.StringUtils;
 10  
 
 11  
 public class DeleteDataChange extends AbstractChange {
 12  
 
 13  
     private String schemaName;
 14  
     private String tableName;
 15  
 
 16  
     @TextNode(nodeName = "where")
 17  
     private String whereClause;
 18  
 
 19  
     public DeleteDataChange() {
 20  10
         super("delete", "Delete Data", ChangeMetaData.PRIORITY_DEFAULT);
 21  10
     }
 22  
 
 23  
     public String getSchemaName() {
 24  0
         return schemaName;
 25  
     }
 26  
 
 27  
     public void setSchemaName(String schemaName) {
 28  0
         this.schemaName = StringUtils.trimToNull(schemaName);
 29  0
     }
 30  
 
 31  
     public String getTableName() {
 32  0
         return tableName;
 33  
     }
 34  
 
 35  
     public void setTableName(String tableName) {
 36  0
         this.tableName = tableName;
 37  0
     }
 38  
 
 39  
     public String getWhereClause() {
 40  0
         return whereClause;
 41  
     }
 42  
 
 43  
     public void setWhereClause(String whereClause) {
 44  0
         this.whereClause = whereClause;
 45  0
     }
 46  
 
 47  
     public SqlStatement[] generateStatements(Database database) {
 48  
 
 49  0
         DeleteStatement statement = new DeleteStatement(getSchemaName() == null ? database.getDefaultSchemaName()
 50  
                 : getSchemaName(), getTableName());
 51  
 
 52  0
         statement.setWhereClause(whereClause);
 53  
 
 54  0
         return new SqlStatement[] { statement };
 55  
     }
 56  
 
 57  
     public String getConfirmationMessage() {
 58  0
         return "Data deleted from " + getTableName();
 59  
     }
 60  
 
 61  
 }