Skip to content

Commit 07abb80

Browse files
authored
schema: add schema changes for event improvements (apache#150)
Schema changes needed for Event Improvements functionality to work are being added in 4.16.0 to 4.16.1. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 92931ae commit 07abb80

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

engine/schema/src/main/resources/META-INF/db/schema-41600to41610.sql

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,51 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervi
160160
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities` (uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported, vm_snapshot_enabled) values (UUID(), 'VMware', '7.0.3.0', 1024, 0, 59, 64, 1, 1);
161161
-- Copy VMware 7.0.1.0 hypervisor guest OS mappings to VMware 7.0.3.0
162162
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'VMware', '7.0.3.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='VMware' AND hypervisor_version='7.0.1.0';
163+
164+
-- Alter event table to add resource_id and resource_type
165+
ALTER TABLE `cloud`.`event`
166+
ADD COLUMN `resource_id` bigint unsigned COMMENT 'ID of the resource associated with the even' AFTER `domain_id`,
167+
ADD COLUMN `resource_type` varchar(32) COMMENT 'Account role in the project (Owner or Regular)' AFTER `resource_id`;
168+
169+
DROP VIEW IF EXISTS `cloud`.`event_view`;
170+
CREATE VIEW `cloud`.`event_view` AS
171+
SELECT
172+
event.id,
173+
event.uuid,
174+
event.type,
175+
event.state,
176+
event.description,
177+
event.resource_id,
178+
event.resource_type,
179+
event.created,
180+
event.level,
181+
event.parameters,
182+
event.start_id,
183+
eve.uuid start_uuid,
184+
event.user_id,
185+
event.archived,
186+
event.display,
187+
user.username user_name,
188+
account.id account_id,
189+
account.uuid account_uuid,
190+
account.account_name account_name,
191+
account.type account_type,
192+
domain.id domain_id,
193+
domain.uuid domain_uuid,
194+
domain.name domain_name,
195+
domain.path domain_path,
196+
projects.id project_id,
197+
projects.uuid project_uuid,
198+
projects.name project_name
199+
FROM
200+
`cloud`.`event`
201+
INNER JOIN
202+
`cloud`.`account` ON event.account_id = account.id
203+
INNER JOIN
204+
`cloud`.`domain` ON event.domain_id = domain.id
205+
INNER JOIN
206+
`cloud`.`user` ON event.user_id = user.id
207+
LEFT JOIN
208+
`cloud`.`projects` ON projects.project_account_id = event.account_id
209+
LEFT JOIN
210+
`cloud`.`event` eve ON event.start_id = eve.id;

0 commit comments

Comments
 (0)