Skip to content

Commit dec9416

Browse files
#463 - Added fallback to bit field if boolean update fails
1 parent 246d8bd commit dec9416

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/org/dependencytrack/upgrade/v360/v360Updater.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class v360Updater extends AbstractUpgradeItem {
3333

3434
private static final Logger LOGGER = Logger.getLogger(v360Updater.class);
3535
private static final String STMT_1 = "UPDATE \"PROJECT\" SET \"ACTIVE\" = TRUE WHERE \"ACTIVE\" IS NULL";
36+
private static final String STMT_1_ALT = "UPDATE \"PROJECT\" SET \"ACTIVE\" = 1 WHERE \"ACTIVE\" IS NULL";
3637
private static final String STMT_2 = "DELETE FROM \"CONFIGPROPERTY\" WHERE \"GROUPNAME\" = 'scanner' AND \"PROPERTYNAME\" = 'dependencycheck.enabled'";
3738

3839
public String getSchemaVersion() {
@@ -41,7 +42,12 @@ public String getSchemaVersion() {
4142

4243
public void executeUpgrade(AlpineQueryManager aqm, Connection connection) throws SQLException {
4344
LOGGER.info("Updating project active status. Setting all projects to active");
44-
DbUtil.executeUpdate(connection, STMT_1);
45+
try {
46+
DbUtil.executeUpdate(connection, STMT_1);
47+
} catch (Exception e) {
48+
LOGGER.info("Active field is likely not boolean. Attempting project active status update assuming bit field");
49+
DbUtil.executeUpdate(connection, STMT_1_ALT);
50+
}
4551

4652
LOGGER.info("Removing legacy Dependency-Check configuration settings");
4753
DbUtil.executeUpdate(connection, STMT_2);

0 commit comments

Comments
 (0)