DaanHoogland commented on code in PR #14589:
URL: https://github.com/apache/cloudstack/pull/14589#discussion_r4493349635


##########
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42300to2400.java:
##########
@@ -27,4 +35,26 @@
     public String getUpgradedVersion() {
         return "24.0.0";
     }
+
+    @Override
+    public void performDataMigration(Connection conn) {
+        encryptUserData(conn, "user_vm");
+        encryptUserData(conn, "user_data");
+        encryptUserData(conn, "autoscale_vmprofiles");
+    }
+
+    private void encryptUserData(Connection conn, String table) {
+        try (PreparedStatement selectStatement = 
conn.prepareStatement(String.format("SELECT `id`, `user_data` FROM `cloud`.`%s` 
WHERE `user_data` IS NOT NULL", table));
+             ResultSet resultSet = selectStatement.executeQuery();
+             PreparedStatement updateStatement = 
conn.prepareStatement(String.format("UPDATE `cloud`.`%s` SET `user_data` = ? 
WHERE `id` = ?", table))) {

Review Comment:
   only local calls to this private method



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to