CREATE TABLE `pinglerr_pings` (
  `id` int(11) NOT NULL,
  `ping_avg` float DEFAULT NULL,
  `pkt_transmitted` int(11) DEFAULT NULL,
  `pkt_received` int(11) DEFAULT NULL,
  `scan_id` int(11) NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;


CREATE TABLE `pinglerr_scans` (
  `id` int(11) NOT NULL,
  `start_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `end_date` timestamp NOT NULL,
  `status_code` varchar(255) NOT NULL,
  `host` varchar(255) NOT NULL,
  `error_message` mediumtext DEFAULT NULL,
  `ref_uuid` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

ALTER TABLE `pinglerr_pings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `scan_id` (`scan_id`);

ALTER TABLE `pinglerr_scans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ref_uuid` (`ref_uuid`);

ALTER TABLE `pinglerr_pings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `pinglerr_scans`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;