GutoVeronezi commented on a change in pull request #5785:
URL: https://github.com/apache/cloudstack/pull/5785#discussion_r773171396



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41600to41610.sql
##########
@@ -17,4 +17,111 @@
 
 --;
 -- Schema upgrade from 4.16.0.0 to 4.16.1.0
---;
\ No newline at end of file
+--;
+
+-- Stored procedures to handle cloud and cloud_schema changes
+
+-- Idempotent ADD COLUMN
+DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_COLUMN`;
+CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_COLUMN` (
+    IN in_table_name VARCHAR(200)
+, IN in_column_name VARCHAR(200)
+, IN in_column_definition VARCHAR(1000)
+)
+BEGIN
+    DECLARE CONTINUE HANDLER FOR 1060 BEGIN END; SET @ddl = CONCAT('ALTER 
TABLE ', in_table_name); SET @ddl = CONCAT(@ddl, ' ', 'ADD COLUMN') ; SET @ddl 
= CONCAT(@ddl, ' ', in_column_name); SET @ddl = CONCAT(@ddl, ' ', 
in_column_definition); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE 
stmt; END;

Review comment:
       I think we could separate the commands in multiple lines, to improve 
readability. If this suggestion get accepted, we should also apply to the lines 
below.




-- 
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