CREATE TABLE PortManager
(
    Node1 BIGINT UNSIGNED DEFAULT NULL,
    Node2 BIGINT UNSIGNED DEFAULT NULL,
    IPAddress VARCHAR(15) DEFAULT NULL,
    Port MEDIUMINT DEFAULT NULL,
    Expires BIGINT UNSIGNED DEFAULT NULL,
    KEY ( Expires ),
    PRIMARY KEY ( Node1, Node2, IPAddress, Port ),
    UNIQUE KEY( IPAddress, Port ),
    FOREIGN KEY ( Node1 ) REFERENCES nodes ( id) ON DELETE CASCADE ON UPDATE CASCADE,
    FOREIGN KEY ( Node2 ) REFERENCES nodes ( id) ON DELETE CASCADE ON UPDATE CASCADE

) ENGINE=INNODB CHARSET=UTF8 COMMENT="List of UDP ports used by each device, avoid duplicates";
