START TRANSACTION;

CREATE TABLE `alarm_log` (
    `alarm_log_id` int NOT NULL,
    `source` varchar(255) DEFAULT NULL,
    `user` varchar(6) NOT NULL,
    `imei` varchar(20) DEFAULT NULL,
    `pin` varchar(10) DEFAULT NULL,
    `alarm_type` varchar(3) DEFAULT NULL,
    `position_time` varchar(20) DEFAULT NULL,
    `latitude` varchar(20) DEFAULT NULL,
    `longitude` varchar(20) DEFAULT NULL,
    `url` varchar(255) DEFAULT NULL,
    `comment` varchar(255) DEFAULT NULL,
    `response_code` int DEFAULT NULL,
    `response_text` varchar(255) DEFAULT NULL,
    `date_added` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `alarm_log`
    ADD PRIMARY KEY (`alarm_log_id`);

ALTER TABLE `alarm_log`
    MODIFY `alarm_log_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
COMMIT;
