diff --git a/pandora_console/extras/mr/25.sql b/pandora_console/extras/mr/25.sql index 05c5978fed..7e562b188d 100644 --- a/pandora_console/extras/mr/25.sql +++ b/pandora_console/extras/mr/25.sql @@ -53,7 +53,7 @@ UPDATE `tmensajes` SET `id_source`=(SELECT `id` FROM `tnotification_source` WHER ALTER TABLE `tmensajes` ADD CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -CREATE TABLE `tnotification_user` ( +CREATE TABLE IF NOT EXISTS `tnotification_user` ( `id_mensaje` INT(10) UNSIGNED NOT NULL, `id_user` VARCHAR(60) NOT NULL, `utimestamp_read` BIGINT(20), @@ -66,7 +66,7 @@ CREATE TABLE `tnotification_user` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `tnotification_group` ( +CREATE TABLE IF NOT EXISTS `tnotification_group` ( `id_mensaje` INT(10) UNSIGNED NOT NULL, `id_group` mediumint(4) UNSIGNED NOT NULL, PRIMARY KEY (`id_mensaje`,`id_group`), @@ -74,7 +74,7 @@ CREATE TABLE `tnotification_group` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `tnotification_source_user` ( +CREATE TABLE IF NOT EXISTS `tnotification_source_user` ( `id_source` BIGINT(20) UNSIGNED NOT NULL, `id_user` VARCHAR(60), `enabled` INT(1) DEFAULT NULL, @@ -86,7 +86,7 @@ CREATE TABLE `tnotification_source_user` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `tnotification_source_group` ( +CREATE TABLE IF NOT EXISTS `tnotification_source_group` ( `id_source` BIGINT(20) UNSIGNED NOT NULL, `id_group` mediumint(4) unsigned NOT NULL, PRIMARY KEY (`id_source`,`id_group`), @@ -95,7 +95,7 @@ CREATE TABLE `tnotification_source_group` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `tnotification_source_group_user` ( +CREATE TABLE IF NOT EXISTS `tnotification_source_group_user`( `id_source` BIGINT(20) UNSIGNED NOT NULL, `id_group` mediumint(4) unsigned NOT NULL, `id_user` VARCHAR(60), @@ -113,7 +113,7 @@ CREATE TABLE `tnotification_source_group_user` ( INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES ('Generate Notification','Internal type','This command allows you to send an internal notification to any user or group.',1,'[\"Destination user\",\"Destination group\",\"Title\",\"Message\",\"Link\",\"Criticity\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]'); INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0); - INSERT INTO `tnotification_source_group` ((SELECT `id` FROM `tnotification_source` WHERE `description`="Messages"),0); +INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != ''; COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index c9ae871185..f2634417fb 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -2003,7 +2003,7 @@ INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fi -- ---------------------------------------------------------------------- INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0); INSERT INTO `tnotification_source_group` ((SELECT `id` FROM `tnotification_source` WHERE `description`="Messages"),0); - +INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != ''; -- ---------------------------------------------------------------------- -- Add custom internal recon scripts -- ----------------------------------------------------------------------