 COMMENT ON COLUMN link_to_review.target_time IS 'Target is the date and time at which this link should come up for review. The link will be reviewed sometime after that. All new links for review are currently scheduled for immediate review.';
 
 CREATE TABLE link_review (
-       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,
        target_time TIMESTAMP (0) WITH TIME ZONE NOT NULL,
        actual_time TIMESTAMP (0) WITH TIME ZONE NOT NULL DEFAULT current_timestamp,
        recall_grade REAL NOT NULL,

VALUES (0, 'anonymous', '');

CREATE TABLE member_confirmation (
       member_no INTEGER REFERENCES member (member_no) NOT NULL PRIMARY KEY ON DELETE CASCADE,
       hash TEXT NOT NULL,
       email TEXT NOT NULL,
       email_sent TIMESTAMP (0) WITH TIME ZONE

COMMENT ON COLUMN member_confirmation.email_sent IS 'email_sent is the time a confirmation email was successfully sent (or at least when our MTA says it was sent).';

CREATE TABLE password_reset_token (
       member_no INTEGER REFERENCES member (member_no) ON DELETE CASCADE NOT NULL PRIMARY KEY,
       hash TEXT NOT NULL,
       expires TIMESTAMP (0) WITH TIME ZONE
);
