From f430b8998f6074c7338f2c8f0c271d829f40c2b0 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 3 Jul 2018 12:01:37 +0200 Subject: [PATCH] Added DB changes to support ProvisioningServer 2 --- pandora_console/extras/mr/18.sql | 36 +++++++++++++++ .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 44 +++++++++++++++++++ pandora_console/pandoradb.sql | 43 ++++++++++++++++++ 3 files changed, 123 insertions(+) diff --git a/pandora_console/extras/mr/18.sql b/pandora_console/extras/mr/18.sql index b7e4be33e0..e82f940bfb 100644 --- a/pandora_console/extras/mr/18.sql +++ b/pandora_console/extras/mr/18.sql @@ -10,4 +10,40 @@ ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL DEFAULT '0'; ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL DEFAULT '0'; +CREATE TABLE `tautoconfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(100) NOT NULL, + `order` int(11) NOT NULL DEFAULT '0', + `description` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `tautoconfig_rules` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_autoconfig` int(10) unsigned NOT NULL, + `order_by` int(11) NOT NULL DEFAULT '0', + `operator` enum('AND','OR') DEFAULT 'OR', + `type` enum('alias','ip-range','group','os','custom-field','script') DEFAULT 'alias', + `value` varchar(100) NOT NULL DEFAULT '', + `custom` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `id_autoconfig` (`id_autoconfig`), + CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `tautoconfig_actions` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_autoconfig` int(10) unsigned NOT NULL, + `order` int(11) NOT NULL DEFAULT '0', + `action_type` enum('set-group', 'set-secondary-group','apply-policy','apply-all-policies','launch-event','launch-alert-action','raw-config') DEFAULT 'launch-event', + `value` varchar(100) NOT NULL DEFAULT '', + `custom` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `id_autoconfig` (`id_autoconfig`), + CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE 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 6752754a5c..19add1b91a 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 @@ -1667,3 +1667,47 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`( ALTER TABLE tagente ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0'; ALTER TABLE tusuario_perfil ADD COLUMN `is_secondary` tinyint(1) NOT NULL default '0'; + +-- --------------------------------------------------------------------- +-- Table `tautoconfig` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tautoconfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(100) NOT NULL, + `order` int(11) NOT NULL DEFAULT '0', + `description` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tautoconfig_rules` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tautoconfig_rules` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_autoconfig` int(10) unsigned NOT NULL, + `order_by` int(11) NOT NULL DEFAULT '0', + `operator` enum('AND','OR') DEFAULT 'OR', + `type` enum('alias','ip-range','group','os','custom-field','script') DEFAULT 'alias', + `value` varchar(100) NOT NULL DEFAULT '', + `custom` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `id_autoconfig` (`id_autoconfig`), + CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tautoconfig_actions` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tautoconfig_actions` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_autoconfig` int(10) unsigned NOT NULL, + `order` int(11) NOT NULL DEFAULT '0', + `action_type` enum('set-group', 'set-secondary-group','apply-policy','apply-all-policies','launch-event','launch-alert-action','raw-config') DEFAULT 'launch-event', + `value` varchar(100) NOT NULL DEFAULT '', + `custom` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `id_autoconfig` (`id_autoconfig`), + CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 5b77263b6a..a06099511b 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -3195,3 +3195,46 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`( ON DELETE CASCADE ) engine=InnoDB DEFAULT CHARSET=utf8; +-- --------------------------------------------------------------------- +-- Table `tautoconfig` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tautoconfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(100) NOT NULL, + `order` int(11) NOT NULL DEFAULT '0', + `description` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tautoconfig_rules` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tautoconfig_rules` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_autoconfig` int(10) unsigned NOT NULL, + `order_by` int(11) NOT NULL DEFAULT '0', + `operator` enum('AND','OR') DEFAULT 'OR', + `type` enum('alias','ip-range','group','os','custom-field','script') DEFAULT 'alias', + `value` varchar(100) NOT NULL DEFAULT '', + `custom` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `id_autoconfig` (`id_autoconfig`), + CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tautoconfig_actions` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tautoconfig_actions` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_autoconfig` int(10) unsigned NOT NULL, + `order` int(11) NOT NULL DEFAULT '0', + `action_type` enum('set-group', 'set-secondary-group','apply-policy','apply-all-policies','launch-event','launch-alert-action','raw-config') DEFAULT 'launch-event', + `value` varchar(100) NOT NULL DEFAULT '', + `custom` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `id_autoconfig` (`id_autoconfig`), + CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +