CREATE TABLE LockNode
(
    id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    Ts BIGINT UNSIGNED NOT NULL,
    Node BIGINT UNSIGNED NOT NULL,
    Person BIGINT UNSIGNED NOT NULL,
    Session BIGINT UNSIGNED NOT NULL,
    PRIMARY KEY ( id ),
    KEY Node ( Node ),
    KEY Session ( Session ),
    UNIQUE KEY ( Node ),
    FOREIGN KEY ( Session ) REFERENCES Session ( id) ON DELETE CASCADE ON UPDATE RESTRICT

) ENGINE=INNODB CHARSET=UTF8 COMMENT="Lock node for writing";
