USE infra_dashboard;

CREATE TABLE `dashboard_os` (
  `id` int NOT NULL AUTO_INCREMENT,
  `distribution` varchar(20) COLLATE utf8mb4_general_ci NOT NULL,
  `version` varchar(10) COLLATE utf8mb4_general_ci NOT NULL,
  `end_of_support` date DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `dashboard_os_distribution_version_73a59db0_uniq` (`distribution`,`version`)
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `dashboard_package` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `active` int NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ;

CREATE TABLE `dashboard_server` (
  `id` int NOT NULL AUTO_INCREMENT,
  `hostname` varchar(200) COLLATE utf8mb4_general_ci NOT NULL,
  `os_id` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `hostname` (`hostname`),
  KEY `dashboard_server_os_id_1420b5ff_fk_dashboard_os_id` (`os_id`),
  CONSTRAINT `dashboard_server_os_id_1420b5ff_fk_dashboard_os_id` FOREIGN KEY (`os_id`) REFERENCES `dashboard_os` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=385 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ;

CREATE TABLE `dashboard_packagestatus` (
  `id` int NOT NULL AUTO_INCREMENT,
  `package_name` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
  `package_version` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
  `server_id` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `dashboard_packagesta_server_id_a3393991_fk_dashboard` (`server_id`),
  CONSTRAINT `dashboard_packagesta_server_id_a3393991_fk_dashboard` FOREIGN KEY (`server_id`) REFERENCES `dashboard_server` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=262048 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `dashboard_os` VALUES (1,'Unknown','1',NULL),(2,'Debian','4','2010-02-28'),(3,'Debian','5','2012-02-06'),(4,'Debian','6','2016-02-06'),(5,'Debian','7','2018-04-01'),(6,'Debian','8','2020-04-01'),(7,'Debian','9','2022-06-30'),(8,'Debian','10','2024-06-30'),(9,'Debian','11','2026-06-30'),(10,'Ubuntu','10.04','2015-04-30'),(11,'Ubuntu','10.10','2012-04-10'),(12,'Ubuntu','11.04','2012-10-28'),(13,'Ubuntu','11.10','2013-05-09'),(14,'Ubuntu','12.04','2017-04-01'),(15,'Ubuntu','12.10','2014-05-16'),(16,'Ubuntu','13.04','2014-01-27'),(17,'Ubuntu','13.10','2014-07-17'),(18,'Ubuntu','14.04','2019-04-01'),(19,'Ubuntu','14.10','2015-07-23'),(20,'Ubuntu','15.04','2016-02-04'),(21,'Ubuntu','15.10','2016-07-28'),(22,'Ubuntu','16.04','2021-04-01'),(23,'Ubuntu','16.10','2017-07-01'),(24,'Ubuntu','17.04','2018-01-31'),(25,'Ubuntu','17.10','2018-07-31'),(26,'Ubuntu','18.04','2023-04-01'),(27,'Ubuntu','20.04','2025-04-01'),(28,'Ubuntu','22.04','2027-04-01'),(29,'CentOS','4','2012-02-29'),(30,'CentOS','5','2017-03-31'),(31,'CentOS','6','2020-11-30'),(32,'CentOS','7','2024-06-30'),(33,'RedHat','5','2017-03-31'),(34,'RedHat','6','2020-11-30'),(35,'RedHat','7','2024-06-30'),(36,'FreeBSD','9.0','2013-03-31'),(37,'FreeBSD','9.1','2014-12-31'),(38,'FreeBSD','9.2','2014-12-31'),(39,'FreeBSD','9.3','2016-12-31'),(40,'FreeBSD','10.0','2015-02-28'),(41,'FreeBSD','10.1','2016-12-31'),(42,'FreeBSD','10.2','2016-12-31'),(43,'FreeBSD','10.3','2018-04-30'),(44,'OpenBSD','5.0','2012-11-01'),(45,'OpenBSD','5.1','2013-05-01'),(46,'OpenBSD','5.2','2013-11-01'),(47,'OpenBSD','5.3','2014-05-01'),(48,'OpenBSD','5.4','2014-11-01'),(49,'OpenBSD','5.5','2015-05-01'),(50,'OpenBSD','5.6','2015-10-18'),(51,'OpenBSD','5.7','2016-03-29'),(52,'OpenBSD','5.8','2016-09-01'),(53,'OpenBSD','5.9','2017-04-11'),(54,'OpenBSD','6.0','2017-11-09'),(55,'OpenBSD','6.1','2018-05-01'),(56,'OpenBSD','6.2','2018-11-01'),(57,'OpenBSD','6.3','2019-05-01'),(58,'OpenBSD','6.4','2019-11-01'),(59,'Debian','12','2028-06-30'),(60,'Ubuntu','24.04','2029-04-01'),(61,'Test','12','2024-04-25');

