rhtyd commented on a change in pull request #3268: Support sort_key for
vpc_offerings table
URL: https://github.com/apache/cloudstack/pull/3268#discussion_r272992711
##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41200to41300.sql
##########
@@ -19,3 +19,16 @@
-- Schema upgrade from 4.12.0.0 to 4.13.0.0
--;
+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 1091 BEGIN END; SET @ddl = CONCAT('DROP INDEX
', in_index_name); SET @ddl = CONCAT(@ddl, ' ', ' ON ') ; SET @ddl =
CONCAT(@ddl, ' ', in_table_name); PREPARE stmt FROM @ddl; EXECUTE stmt;
DEALLOCATE PREPARE stmt; END;
+
+-- Add For VPC flag
+CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','sort_key',
'INT(32) NOT NULL DEFAULT 0');
Review comment:
We can simply add the column, we don't expect past versions to have the
column.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services