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;

CREATE TABLE `dashboard_serverstatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `uptime` int(11) DEFAULT NULL,
  `updates` int(11) DEFAULT NULL,
  `auto_updates` varchar(3) NOT NULL,
  `server_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `dashboard_serverstatus_date_server_id_56b75b29_uniq` (`date`,`server_id`),
  KEY `dashboard_serverstatus_server_id_12056d14_fk_dashboard_server_id` (`server_id`),
  CONSTRAINT `dashboard_serverstatus_server_id_12056d14_fk_dashboard_server_id` FOREIGN KEY (`server_id`) REFERENCES `dashboard_server` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36172 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
