CREATE TABLE IF NOT EXISTS `autoresponder_seen` (
  `ident` int(11) NOT NULL,
  `sender` varchar(255) NOT NULL,
  `time` datetime NOT NULL,
  `server_id` varchar(32) NOT NULL,
  KEY `ident` (`ident`),
  KEY `server_id` (`server_id`)
);

-- [v0.3] convert BLOB to TEXT

ALTER TABLE `autoresponder`
ADD `emailtext_tmp` TEXT NOT NULL AFTER `emailtext`;

UPDATE `autoresponder`
SET `emailtext_tmp` = CAST(emailtext AS CHAR(65535) CHARACTER SET latin1);

ALTER TABLE `autoresponder`
DROP `emailtext`,
CHANGE `emailtext_tmp` `emailtext` TEXT NOT NULL;

-- [v0.5] add valid_from + valid_till

ALTER TABLE `autoresponder`
ADD `valid_from` DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER emailtext,
ADD `valid_till` DATETIME NOT NULL DEFAULT '9999-12-31 23:59:59' AFTER valid_from;

-- [v0.6] utf8

ALTER TABLE `autoresponder`
CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
