CREATE TABLE `mqtt_out` (
  `Log_ID` int(9) NOT NULL AUTO_INCREMENT,
  `Status` enum('Sent','Fail','Pending') default 'Pending',
  `Topic` varchar(255) NOT NULL,
  `Message` text,
  `QoS` tinyint(1) NOT NULL DEFAULT 0,
  `Retain` tinyint(1) NOT NULL DEFAULT 0,
  `Error` varchar(255),
  `Checksum` varchar(32),
  `Creation_Date` timestamp DEFAULT CURRENT_TIMESTAMP,
  `Last_Edit` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`Log_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `mqtt_in` (
  `Topic` varchar(255) NOT NULL,
  `Message` text,
  `Checksum` varchar(32),
  `Last_Edit` timestamp DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`Last_Edit`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

