 COMMENT ON COLUMN link_review.recall_time IS 'Recall time is the amount of time (in milliseconds) taken to recall (or not) the destination of a link. It could be measured as the time between when the page is displayed and when the destination lexeme is shown (using JavaScript).';
 
 CREATE TABLE link_sm2 (
-       member_no INTEGER REFERENCES member (member_no) NOT NULL ON UPDATE CASCADE ON DELETE CASCADE,
-       link_no INTEGER REFERENCES link (link_no) NOT NULL ON UPDATE CASCADE ON DELETE CASCADE,
+       member_no INTEGER REFERENCES member (member_no) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
+       link_no INTEGER REFERENCES link (link_no) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
        n SMALLINT NOT NULL DEFAULT 1,
        EF REAL NOT NULL DEFAULT 2.5,
        PRIMARY KEY (member_no, link_no)

       link_no SERIAL PRIMARY KEY,
       learn TEXT NOT NULL CHECK (length(foreign_phrase) > 0),
       known TEXT NOT NULL CHECK (length(familiar_phrase) > 0),
       learn_lang CHARACTER VARYING (3) REFERENCES language (abbr) NOT NULL ON UPDATE CASCADE,
       known_lang CHARACTER VARYING (3) REFERENCES language (abbr) NOT NULL ON UPDATE CASCADE,
       created TIMESTAMP (0) WITH TIME ZONE NOT NULL DEFAULT current_timestamp,
       deleted BOOLEAN NOT NULL DEFAULT FALSE
);

END; $$ LANGUAGE plpgsql;

CREATE TABLE link_comment (
       link_no INTEGER REFERENCES link (link_no) ON DELETE CASCADE NOT NULL,
       root_comment INTEGER REFERENCES comment (comment_no) ON DELETE CASCADE NOT NULL,
       PRIMARY KEY (link_no, root_comment)
);

