pandorafms/pandora_console/extras/mr/65.sql

70 lines
3.1 KiB
MySQL
Raw Normal View History

2023-06-08 14:06:15 +02:00
START TRANSACTION;
2023-06-19 16:14:21 +02:00
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
`id` INT NOT NULL,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tnetwork_usage_filter` (
`id` INT NOT NULL auto_increment,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tlayout`
2023-06-07 12:46:39 +02:00
ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`,
ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;
ALTER TABLE `tlayout_template`
ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`,
ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;
2023-06-07 12:46:39 +02:00
2023-06-21 10:54:07 +02:00
DELETE FROM tconfig WHERE token = 'refr';
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (37,2,'CPU','CPU','','Brand;Clock;Model','',0,2);
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (38,2,'RAM','RAM','','Size','',0,2);
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (39,2,'NIC','NIC','','NIC;Mac;Speed','',0,2);
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (40,2,'Software','Software','','PKGINST;VERSION;NAME','',0,2);
2023-06-08 14:06:15 +02:00
2023-05-11 14:54:34 +02:00
ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`;
2023-06-08 14:06:15 +02:00
CREATE TABLE IF NOT EXISTS `tevent_comment` (
`id` serial PRIMARY KEY,
`id_event` BIGINT UNSIGNED NOT NULL,
`utimestamp` BIGINT NOT NULL DEFAULT 0,
`comment` TEXT,
`id_user` VARCHAR(255) DEFAULT NULL,
`action` TEXT,
FOREIGN KEY (`id_event`) REFERENCES `tevento`(`id_evento`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_user`) REFERENCES tusuario(`id_user`)
ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
INSERT INTO `tevent_comment` (`id_event`, `utimestamp`, `comment`, `id_user`, `action`)
SELECT * FROM (
SELECT tevento.id_evento AS `id_event`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].utimestamp'))) AS `utimestamp`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].comment'))) AS `comment`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].id_user'))) AS `id_user`,
JSON_UNQUOTE(JSON_EXTRACT(tevento.user_comment, CONCAT('$[',n.num,'].action'))) AS `action`
FROM tevento
INNER JOIN (SELECT 0 num UNION ALL SELECT 1 UNION ALL SELECT 2) n
ON n.num < JSON_LENGTH(tevento.user_comment)
WHERE tevento.user_comment != ""
) t order by utimestamp DESC;
ALTER TABLE tevento DROP COLUMN user_comment;
2023-06-07 12:46:39 +02:00
COMMIT;