diff --git a/pandora_console/extras/mr/52.sql b/pandora_console/extras/mr/52.sql index 2d0cd15fa4..a77be76ddc 100644 --- a/pandora_console/extras/mr/52.sql +++ b/pandora_console/extras/mr/52.sql @@ -14,4 +14,15 @@ SOURCE procedures/alertEvents.sql; CALL `migrateEventRanges`(); DROP PROCEDURE `migrateEventRanges`; +CREATE TABLE IF NOT EXISTS `tpolicy_group_agents` ( + `id` SERIAL, + `id_policy` INT UNSIGNED, + `id_agent` INT UNSIGNED, + `direct` TINYINT UNSIGNED DEFAULT 0, + FOREIGN KEY (`id_policy`) REFERENCES `tpolicies`(`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + 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 3848aad972..59e0a15547 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 @@ -213,6 +213,20 @@ CREATE TABLE IF NOT EXISTS `tpolicy_groups` ( UNIQUE (`id_policy`, `id_group`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `tpolicy_group_agents` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tpolicy_group_agents` ( + `id` SERIAL, + `id_policy` INT UNSIGNED, + `id_agent` INT UNSIGNED, + `direct` TINYINT UNSIGNED DEFAULT 0, + FOREIGN KEY (`id_policy`) REFERENCES `tpolicies`(`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- --------------------------------------------------------------------- -- Table `tdashboard` -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 40b6770737..9994c0f11d 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -2592,6 +2592,21 @@ CREATE TABLE IF NOT EXISTS `tpolicy_groups` ( UNIQUE (`id_policy`, `id_group`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ----------------------------------------------------- +-- Table `tpolicy_group_agents` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tpolicy_group_agents` ( + `id` SERIAL, + `id_policy` INT UNSIGNED, + `id_agent` INT UNSIGNED, + `direct` TINYINT UNSIGNED DEFAULT 0, + FOREIGN KEY (`id_policy`) REFERENCES `tpolicies`(`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- --------------------------------------------------------------------- -- Table `tdashboard` -- ---------------------------------------------------------------------