You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "sureshanaparti (via GitHub)" <gi...@apache.org> on 2026/09/07 09:36:59 UTC

Re: [PR] refactoring views out of upgrade db schema scripts [cloudstack]

sureshanaparti commented on code in PR #9401:
URL: https://github.com/apache/cloudstack/pull/9401#discussion_r3948428180


##########
engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql:
##########
@@ -111,8 +110,9 @@ FROM
     `cloud`.`ha_config` ON ha_config.resource_id=host.id
         and ha_config.resource_type='Host'
         LEFT JOIN
-    `cloud`.`last_annotation_view` ON `last_annotation_view`.`entity_uuid` = `host`.`uuid`
+    (SELECT `annotations`.`entity_uuid`, `annotations`.`user_uuid`, MAX(`annotations`.`created`) AS created, `annotations`.`annotation`
+    FROM `cloud`.`annotations` WHERE `annotations`.`removed` IS NULL GROUP BY `annotations`.`entity_uuid`) AS last_annotated ON last_annotated.entity_uuid = host.uuid
         LEFT JOIN
-    `cloud`.`user` ON `user`.`uuid` = `last_annotation_view`.`user_uuid`
+    `cloud`.`user` ON `user`.`uuid` = last_annotated.user_uuid

Review Comment:
   hi @KlausDornsbach last_annotation_view maynot be required now, can we remove this view file engine/schema/src/main/resources/META-INF/db/views/cloud.last_annotation_view.sql? otherwise, the view will be created and unused.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org