102 lines
4.5 KiB
Text
102 lines
4.5 KiB
Text
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
|
DROP TABLE IF EXISTS `contacts`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
CREATE TABLE `contacts` (
|
|
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
|
`surname` varchar(200) NOT NULL,
|
|
`firstname` varchar(200) NOT NULL,
|
|
`email` varchar(250) NOT NULL,
|
|
`phone` varchar(20) NOT NULL,
|
|
`creation_date` datetime NOT NULL,
|
|
`active` int NOT NULL DEFAULT '1',
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
DROP TABLE IF EXISTS `groups`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
CREATE TABLE `groups` (
|
|
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(128) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
DROP TABLE IF EXISTS `migrations`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
CREATE TABLE `migrations` (
|
|
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
|
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
`batch` int NOT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
DROP TABLE IF EXISTS `notifications`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
CREATE TABLE `notifications` (
|
|
`task_id` int unsigned NOT NULL,
|
|
`contact_id` int unsigned NOT NULL,
|
|
PRIMARY KEY (`task_id`,`contact_id`),
|
|
KEY `contact_id` (`contact_id`),
|
|
CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE,
|
|
CONSTRAINT `notifications_ibfk_2` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
DROP TABLE IF EXISTS `tasks`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
CREATE TABLE `tasks` (
|
|
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
|
`host` varchar(255) NOT NULL,
|
|
`type` enum('ping','http') NOT NULL,
|
|
`params` varchar(255) NOT NULL,
|
|
`creation_date` datetime NOT NULL,
|
|
`frequency` int unsigned NOT NULL,
|
|
`last_execution` datetime DEFAULT NULL,
|
|
`active` int NOT NULL DEFAULT '0',
|
|
`group_id` int unsigned DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `host` (`host`,`type`),
|
|
KEY `group_id_frgn` (`group_id`),
|
|
CONSTRAINT `group_id_frgn` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
DROP TABLE IF EXISTS `tasks_archives`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
CREATE TABLE `tasks_archives` (
|
|
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
|
`day` date NOT NULL,
|
|
`uptime` int unsigned NOT NULL DEFAULT '0',
|
|
`task_id` int unsigned NOT NULL DEFAULT '0',
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
DROP TABLE IF EXISTS `tasks_history`;
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
CREATE TABLE `tasks_history` (
|
|
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
|
`status` int unsigned NOT NULL,
|
|
`datetime` datetime NOT NULL,
|
|
`output` text CHARACTER SET utf8 COLLATE utf8_general_ci,
|
|
`task_id` int unsigned NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `task_id` (`task_id`),
|
|
CONSTRAINT `tasks_history_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
|
|
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
|
|