CREATE TABLE NotifyMethodChooser
(
    id BIGINT UNSIGNED DEFAULT NULL,
    Notification BIGINT UNSIGNED DEFAULT NULL COMMENT "Notification launch ID",
    Person BIGINT UNSIGNED DEFAULT NULL COMMENT "Person in a launch for which we need to choose communication methods",
    Communication BIGINT UNSIGNED DEFAULT NULL COMMENT "Communication method implementing the NotifyMethodInterface",
    Interface VARCHAR(35) DEFAULT NULL COMMENT "Class name of the NM that shall handle this communication. The class must implement the NotifyMethodInterface.",
    LastTs BIGINT UNSIGNED DEFAULT NULL,
    Tries INT UNSIGNED DEFAULT 0 COMMENT "Number of attempts made to contact the person for that launch with that communication method",
    Allowed INT UNSIGNED DEFAULT 0 COMMENT "Maximum number of contact attempts allowed for this person/launch/communication method",
    NextTs BIGINT UNSIGNED DEFAULT 0 COMMENT "Earliest time at which the next contact attempt is to be made",
    TempFailCnt INT UNSIGNED DEFAULT 0 COMMENT "Number of temporary failures seen",
    TempFailTs BIGINT UNSIGNED DEFAULT 0 COMMENT "Timestamp of the first time a temporary failure was seen",
    MethodAddress VARCHAR(35) DEFAULT NULL COMMENT "The address matching the node id in the Communication column",
    PRIMARY KEY ( id ) AUTO_INCREMENT,
    UNIQUE KEY ( Notification, Communication ),
    UNIQUE KEY ( Notification, MethodAddress ),
    UNIQUE KEY ( Notification, Person, Communication ),
    KEY ( Notification, Interface ),
    KEY ( Person ),
    FOREIGN KEY ( Person ) REFERENCES Person ( id) ON DELETE RESTRICT ON UPDATE RESTRICT,
    FOREIGN KEY ( Notification ) REFERENCES NotificationLaunch ( id) ON DELETE RESTRICT ON UPDATE RESTRICT

) ENGINE=INNODB CHARSET=UTF8 COMMENT="Communication attempt counts and scheduling for each person/";
