CREATE TABLE FaxPrinterWorker
(
    id BIGINT UNSIGNED DEFAULT NULL,
    LockId CHAR(32) DEFAULT NULL,
    isFailed TINYINT UNSIGNED DEFAULT 0,
    CreationTs BIGINT UNSIGNED DEFAULT NULL,
    PrinterId BIGINT UNSIGNED DEFAULT NULL,
    FaxDocumentId BIGINT UNSIGNED DEFAULT NULL,
    NextAttemptTs BIGINT UNSIGNED DEFAULT 0,
    NumAttempts BIGINT UNSIGNED DEFAULT 0,
    PRIMARY KEY ( id ) AUTO_INCREMENT,
    KEY ( LockId ),

    /* Reading rows after lock */

    KEY ( isFailed,LockId,NextAttemptTs )

) ENGINE=INNODB CHARSET=UTF8 COMMENT="Table for tracking failed faxes that shall be printed throug";
