This commit is contained in:
Daniel Cebrian 2023-04-18 15:56:50 +02:00
parent ea1ace2c71
commit 7514195572
2 changed files with 84 additions and 2 deletions

View File

@ -0,0 +1,42 @@
CREATE TABLE IF NOT EXISTS `tdiscovery_apps` (
`id_app` int(10) auto_increment,
`short_name` varchar(250) NOT NULL DEFAULT '',
`name` varchar(250) NOT NULL DEFAULT '',
`section` varchar(250) NOT NULL DEFAULT 'custom',
`description` varchar(250) NOT NULL DEFAULT '',
`version` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id_app`),
UNIQUE (`short_name`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_scripts` (
`id_app` int(10),
`macro` varchar(250) NOT NULL DEFAULT '',
`value` text NOT NULL DEFAULT '',
PRIMARY KEY (`id_app`, `macro`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_executions` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_app` int(10),
`execution` text NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_tasks_macros` (
`id_task` int(10) unsigned NOT NULL,
`macro` varchar(250) NOT NULL DEFAULT '',
`type` varchar(250) NOT NULL DEFAULT 'custom',
`value` text NOT NULL DEFAULT '',
`temp_conf` tinyint unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id_task`, `macro`),
FOREIGN KEY (`id_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `trecon_task`
ADD COLUMN `id_app` int(10),
ADD COLUMN `setup_complete` tinyint unsigned NOT NULL DEFAULT 0,
ADD FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -830,6 +830,17 @@ CREATE TABLE IF NOT EXISTS `tmodule_group` (
PRIMARY KEY (`id_mg`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps` (
`id_app` int(10) auto_increment,
`short_name` varchar(250) NOT NULL DEFAULT '',
`name` varchar(250) NOT NULL DEFAULT '',
`section` varchar(250) NOT NULL DEFAULT 'custom',
`description` varchar(250) NOT NULL DEFAULT '',
`version` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id_app`),
UNIQUE (`short_name`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- This table was moved cause the `tmodule_relationship` will add
-- a foreign key for the trecon_task(id_rt)
-- ----------------------------------------------------------------------
@ -880,8 +891,11 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
`type` INT NOT NULL DEFAULT 0,
`subnet_csv` TINYINT UNSIGNED DEFAULT 0,
`snmp_skip_non_enabled_ifs` TINYINT UNSIGNED DEFAULT 1,
`id_app` int(10),
`setup_complete` tinyint unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id_rt`),
KEY `recon_task_daemon` (`id_recon_server`)
KEY `recon_task_daemon` (`id_recon_server`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- ----------------------------------------------------------------------
@ -4288,4 +4302,30 @@ CREATE TABLE IF NOT EXISTS `tfavmenu_user` (
`url` TEXT NOT NULL,
`label` VARCHAR(255) NOT NULL,
`section` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`));
PRIMARY KEY (`id`));
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_scripts` (
`id_app` int(10),
`macro` varchar(250) NOT NULL DEFAULT '',
`value` text NOT NULL DEFAULT '',
PRIMARY KEY (`id_app`, `macro`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_executions` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_app` int(10),
`execution` text NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tdiscovery_apps_tasks_macros` (
`id_task` int(10) unsigned NOT NULL,
`macro` varchar(250) NOT NULL DEFAULT '',
`type` varchar(250) NOT NULL DEFAULT 'custom',
`value` text NOT NULL DEFAULT '',
`temp_conf` tinyint unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id_task`, `macro`),
FOREIGN KEY (`id_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;