Copilot commented on code in PR #12881:
URL: https://github.com/apache/cloudstack/pull/12881#discussion_r2985775169


##########
engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql:
##########
@@ -31,7 +31,7 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.account', 
'api_key_access', 'boolean
 CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.account', 
'api_key_access', 'boolean DEFAULT NULL COMMENT "is api key access allowed for 
the account" ');
 
 -- Create a new group for Usage Server related configurations
-INSERT INTO `cloud`.`configuration_group` (`name`, `description`, 
`precedence`) VALUES ('Usage Server', 'Usage Server related configuration', 9);
+INSERT IGNORE INTO `cloud`.`configuration_group` (`name`, `description`, 
`precedence`) VALUES ('Usage Server', 'Usage Server related configuration', 9);

Review Comment:
   Using `INSERT IGNORE` avoids the duplicate-key failure, but it also leaves 
any existing `configuration_group` row unchanged (e.g., stale 
`description`/`precedence`). Consider using an idempotent upsert (`INSERT ... 
ON DUPLICATE KEY UPDATE ...`) or follow with an `UPDATE` to ensure the row 
matches the expected values after the upgrade.
   ```suggestion
   INSERT INTO `cloud`.`configuration_group` (`name`, `description`, 
`precedence`)
       VALUES ('Usage Server', 'Usage Server related configuration', 9)
       ON DUPLICATE KEY UPDATE `description` = VALUES(`description`), 
`precedence` = VALUES(`precedence`);
   ```



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