harikrishna-patnala commented on code in PR #6202:
URL: https://github.com/apache/cloudstack/pull/6202#discussion_r885153156
##########
engine/schema/src/main/resources/META-INF/db/schema-41610to41700.sql:
##########
@@ -934,6 +934,330 @@ CREATE VIEW `cloud`.`event_view` AS
LEFT JOIN
`cloud`.`event` eve ON event.start_id = eve.id;
+CREATE TABLE `cloud`.`user_data` (
+ `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
+ `uuid` varchar(40) NOT NULL COMMENT 'UUID of the user data',
+ `name` varchar(256) NOT NULL COMMENT 'name of the user data',
+ `account_id` bigint unsigned NOT NULL COMMENT 'owner, foreign key to account
table',
+ `domain_id` bigint unsigned NOT NULL COMMENT 'domain, foreign key to domain
table',
+ `user_data` mediumtext COMMENT 'value of the userdata',
+ `params` mediumtext COMMENT 'value of the comma-separated list of
parameters',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_userdata__account_id` FOREIGN KEY(`account_id`) REFERENCES
`account` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk_userdata__domain_id` FOREIGN KEY(`domain_id`) REFERENCES
`domain` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `uc_userdata__uuid` UNIQUE (`uuid`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+ALTER TABLE `cloud`.`user_vm` ADD COLUMN `user_data_id` bigint unsigned
DEFAULT NULL COMMENT 'id of the user data' AFTER `user_data`;
+ALTER TABLE `cloud`.`user_vm` ADD COLUMN `user_data_details` mediumtext
DEFAULT NULL COMMENT 'value of the comma-separated list of parameters' AFTER
`user_data_id`;
+ALTER TABLE `cloud`.`user_vm` ADD CONSTRAINT `fk_user_vm__user_data_id`
FOREIGN KEY `fk_user_vm__user_data_id`(`user_data_id`) REFERENCES
`user_data`(`id`) ON DELETE CASCADE;
+
+ALTER TABLE `cloud`.`vm_template` ADD COLUMN `user_data_id` bigint unsigned
DEFAULT NULL COMMENT 'id of the user data';
+ALTER TABLE `cloud`.`vm_template` ADD COLUMN `user_data_link_policy`
varchar(255) DEFAULT NULL COMMENT 'user data link policy with template';
+ALTER TABLE `cloud`.`vm_template` ADD CONSTRAINT
`fk_vm_template__user_data_id` FOREIGN KEY
`fk_vm_template__user_data_id`(`user_data_id`) REFERENCES `user_data`(`id`) ON
DELETE CASCADE;
Review Comment:
Good catch @weizhouapache thanks. But for some reason I did not observe this
happening on deletion of userdata, may be because of other foreign key
constraints. But yeah better to remove this. I've updated the PR.
--
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]