You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/02/16 12:23:38 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #4649: add creation date as a value for domains and accounts.

DaanHoogland commented on a change in pull request #4649:
URL: https://github.com/apache/cloudstack/pull/4649#discussion_r576783045



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41510to41600.sql
##########
@@ -19,3 +19,285 @@
 -- Schema upgrade from 4.15.1.0 to 4.16.0.0
 --;
 
+
+--;
+-- Stored procedure to do idempotent column add;
+-- This is copied from schema-41000to41100.sql
+--;
+DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_COLUMN`;
+
+CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_COLUMN` (

Review comment:
       @soreana FYI see https://github.com/apache/cloudstack/commit/543f9827ff83e1b8f433d98fbe4d5518387b440d#r47173483
   
   @sureshanaparti has concocted a solution:
   
   ```
   DELIMITER $$
   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 $$
   DELIMITER ;
   ```
   
   but more important, this code already exists in the system at https://github.com/apache/cloudstack/blob/master/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql#L27
   
   why did you add it again?




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

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