| 1 |
|
package liquibase.change.custom; |
| 2 |
|
|
| 3 |
|
import liquibase.database.Database; |
| 4 |
|
import liquibase.exception.RollbackImpossibleException; |
| 5 |
|
import liquibase.exception.SetupException; |
| 6 |
|
import liquibase.exception.UnsupportedChangeException; |
| 7 |
|
import liquibase.exception.ValidationErrors; |
| 8 |
|
import liquibase.resource.ResourceAccessor; |
| 9 |
|
import liquibase.statement.SqlStatement; |
| 10 |
|
import liquibase.statement.core.RawSqlStatement; |
| 11 |
|
|
|
|
|
| 56.5% |
Uncovered Elements: 10 (23) |
Complexity: 12 |
Complexity Density: 1.09 |
|
| 12 |
|
public class ExampleCustomSqlChange implements CustomSqlChange, CustomSqlRollback { |
| 13 |
|
|
| 14 |
|
private String tableName; |
| 15 |
|
private String columnName; |
| 16 |
|
private String newValue; |
| 17 |
|
|
| 18 |
|
@SuppressWarnings({"UnusedDeclaration", "FieldCanBeLocal"}) |
| 19 |
|
private ResourceAccessor resourceAccessor; |
| 20 |
|
|
| 21 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 22 |
1
|
public String getTableName() {... |
| 23 |
1
|
return tableName; |
| 24 |
|
} |
| 25 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 26 |
1
|
public void setTableName(String tableName) {... |
| 27 |
1
|
this.tableName = tableName; |
| 28 |
|
} |
| 29 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 30 |
1
|
public String getColumnName() {... |
| 31 |
1
|
return columnName; |
| 32 |
|
} |
| 33 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 34 |
1
|
public void setColumnName(String columnName) {... |
| 35 |
1
|
this.columnName = columnName; |
| 36 |
|
} |
| 37 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 38 |
0
|
public String getNewValue() {... |
| 39 |
0
|
return newValue; |
| 40 |
|
} |
| 41 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 42 |
0
|
public void setNewValue(String newValue) {... |
| 43 |
0
|
this.newValue = newValue; |
| 44 |
|
} |
| 45 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 46 |
1
|
public SqlStatement[] generateStatements(Database database) {... |
| 47 |
1
|
return new SqlStatement[]{ |
| 48 |
|
new RawSqlStatement("update "+tableName+" set "+columnName+" = "+newValue) |
| 49 |
|
}; |
| 50 |
|
} |
| 51 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 52 |
0
|
public SqlStatement[] generateRollbackStatements(Database database) throws UnsupportedChangeException, RollbackImpossibleException {... |
| 53 |
0
|
return new SqlStatement[]{ |
| 54 |
|
new RawSqlStatement("update "+tableName+" set "+columnName+" = null") |
| 55 |
|
}; |
| 56 |
|
} |
| 57 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 58 |
0
|
public String getConfirmationMessage() {... |
| 59 |
0
|
return "Custom class updated "+tableName+"."+columnName; |
| 60 |
|
} |
| 61 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 62 |
1
|
public void setUp() throws SetupException {... |
| 63 |
|
} |
| 64 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 65 |
1
|
public void setFileOpener(ResourceAccessor resourceAccessor) {... |
| 66 |
1
|
this.resourceAccessor = resourceAccessor; |
| 67 |
|
} |
| 68 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 69 |
0
|
public ValidationErrors validate(Database database) {... |
| 70 |
0
|
return new ValidationErrors(); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
} |