Coverage Report - liquibase.change.core.DropIndexChange
 
Classes in this File Line Coverage Branch Coverage Complexity
DropIndexChange
87%
14/16
100%
2/2
1.091
 
 1  
 package liquibase.change.core;
 2  
 
 3  
 import liquibase.change.AbstractChange;
 4  
 import liquibase.change.ChangeMetaData;
 5  
 import liquibase.change.ChangeProperty;
 6  
 import liquibase.database.Database;
 7  
 import liquibase.statement.SqlStatement;
 8  
 import liquibase.statement.core.DropIndexStatement;
 9  
 import liquibase.util.StringUtils;
 10  
 
 11  
 /**
 12  
  * Drops an existing index.
 13  
  */
 14  
 public class DropIndexChange extends AbstractChange {
 15  
 
 16  
     private String schemaName;
 17  
     private String indexName;
 18  
     private String tableName;
 19  
 
 20  
     @ChangeProperty(includeInSerialization = false)
 21  
     private String associatedWith;
 22  
 
 23  
     public DropIndexChange() {
 24  17
         super("dropIndex", "Drop Index", ChangeMetaData.PRIORITY_DEFAULT);
 25  17
     }
 26  
 
 27  
     public String getSchemaName() {
 28  47
         return schemaName;
 29  
     }
 30  
 
 31  
     public void setSchemaName(String schemaName) {
 32  1
         this.schemaName = StringUtils.trimToNull(schemaName);
 33  1
     }
 34  
 
 35  
     public String getIndexName() {
 36  47
         return indexName;
 37  
     }
 38  
 
 39  
     public void setIndexName(String indexName) {
 40  3
         this.indexName = indexName;
 41  3
     }
 42  
 
 43  
     public String getTableName() {
 44  47
         return tableName;
 45  
     }
 46  
 
 47  
     public void setTableName(String tableName) {
 48  2
         this.tableName = tableName;
 49  2
     }
 50  
 
 51  
     public SqlStatement[] generateStatements(Database database) {
 52  46
         return new SqlStatement[] { new DropIndexStatement(getIndexName(),
 53  
                 getSchemaName() == null ? database.getDefaultSchemaName() : getSchemaName(), getTableName(),
 54  
                 getAssociatedWith()) };
 55  
     }
 56  
 
 57  
     public String getConfirmationMessage() {
 58  1
         return "Index " + getIndexName() + " dropped from table " + getTableName();
 59  
     }
 60  
 
 61  
     public String getAssociatedWith() {
 62  46
         return associatedWith;
 63  
     }
 64  
 
 65  
     public void setAssociatedWith(String associatedWith) {
 66  0
         this.associatedWith = associatedWith;
 67  0
     }
 68  
 }