Added DB changes to support ProvisioningServer 2

This commit is contained in:
fbsanchez 2018-07-03 12:01:37 +02:00
parent 95678f706b
commit f430b8998f
3 changed files with 123 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;