Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.cloud.utils.crypt.DBEncryptionUtil;
import com.cloud.utils.exception.CloudRuntimeException;
Expand Down Expand Up @@ -51,6 +53,7 @@ public InputStream[] getPrepareScripts() {
@Override
public void performDataMigration(Connection conn) {
unhideJsInterpretationEnabled(conn);
dropUsageVmInstanceIndex(conn);
}

protected void unhideJsInterpretationEnabled(Connection conn) {
Expand Down Expand Up @@ -89,4 +92,11 @@ protected void updateJsInterpretationEnabledFields(Connection conn, String encry
logger.warn("Error while decrypting configuration 'js.interpretation.enabled'. The configuration may already be decrypted.");
}
}

private void dropUsageVmInstanceIndex(Connection conn) {
final List<String> indexList = new ArrayList<>();
logger.debug("Dropping index vm_instance_id from usage_vm_instance table if it exists");
indexList.add("vm_instance_id");
DbUpgradeUtils.dropKeysIfExist(conn, "cloud_usage.usage_vm_instance", indexList, false);
}
}
Loading