This is an automated email from the ASF dual-hosted git repository.

weizhouapache pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 75748a5cb85 upgrade: Include the database changes from #13019 in the 
4.22.1 -> 4.23.0 path (#13617)
75748a5cb85 is described below

commit 75748a5cb8524d8453d2544d1c5ffe065f1e4d0b
Author: Fabricio Duarte <[email protected]>
AuthorDate: Tue Jul 14 14:01:52 2026 -0300

    upgrade: Include the database changes from #13019 in the 4.22.1 -> 4.23.0 
path (#13617)
---
 .../main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git 
a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java 
b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java
index 393f2039950..b60a52bba88 100644
--- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java
+++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java
@@ -21,6 +21,8 @@ import java.sql.Connection;
 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;
@@ -51,6 +53,7 @@ public class Upgrade42210to42300 extends 
DbUpgradeAbstractImpl implements DbUpgr
     @Override
     public void performDataMigration(Connection conn) {
         unhideJsInterpretationEnabled(conn);
+        dropUsageVmInstanceIndex(conn);
     }
 
     protected void unhideJsInterpretationEnabled(Connection conn) {
@@ -89,4 +92,11 @@ public class Upgrade42210to42300 extends 
DbUpgradeAbstractImpl implements DbUpgr
             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);
+    }
 }

Reply via email to