CREATE TABLE SMSCommunicationOutboundLogs
(
    id          BIGINT NOT NULL AUTO_INCREMENT,
    Zone        BIGINT UNSIGNED NOT NULL COMMENT "Zone ID into which this SMS was sent out.",
    Launch      BIGINT UNSIGNED DEFAULT NULL COMMENT "Launch ID related to this communication, if known",
    SMSNode     BIGINT UNSIGNED DEFAULT NULL COMMENT "SMS Node ID related to this communication, if known",
    Provider    VARCHAR(25) DEFAULT NULL COMMENT "Operator network onto which this text is sent out",
    Mobile      VARCHAR(35) NOT NULL COMMENT "Mobile number, in E.164 format, where this text is sent out",
    Supplier    VARCHAR(15) NOT NULL COMMENT "Supplier name that will carry the text to the destination",
    FromSmsCode VARCHAR(16) DEFAULT NULL COMMENT "Supplier FROM number (source) from which the text will be sent out",
    Message     TEXT NOT NULL COMMENT "Message or text to be sent to mobile",
    Ts          BIGINT UNSIGNED NOT NULL COMMENT "Timestamp when the text was sent out to the supplier",
    DurationMs  INT UNSIGNED NOT NULL COMMENT "Duration, in millisecond, of transaction, or row handling",
    ConfirmId   VARCHAR(48) DEFAULT NULL COMMENT "Supplier confirmation code or NULL if attempt FAILED",
    DeliveryTs  BIGINT UNSIGNED NOT NULL COMMENT "Timestamp when the text was delivered to the mobile device",
    Status      ENUM( 'SEND_OK', 'SEND_FAILURE', 'DELIVERY_OK', 'DELIVERY_FAILURE' ) NOT NULL,
    Info        VARCHAR(256) DEFAULT NULL COMMENT "If status is NOT OK, we can find more details in this column.",

    PRIMARY KEY ( id ),

    KEY ( ConfirmId )

) ENGINE=INNODB CHARSET=UTF8 COMMENT="Logs of outbound SMS communications";
