{"item": {"columns": [[0, "i_id", "INTEGER", 1, null, 1], [1, "title", "varchar(20)", 0, "NULL", 0]], "primary_keys": ["i_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "review": {"columns": [[0, "a_id", "INTEGER", 1, null, 1], [1, "u_id", "INTEGER", 1, null, 0], [2, "i_id", "INTEGER", 1, null, 0], [3, "rating", "INTEGER", 0, "NULL", 0], [4, "rank", "INTEGER", 0, "NULL", 0]], "primary_keys": ["a_id"], "foreign_keys": [[0, 0, "item", "i_id", "i_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "useracct", "u_id", "u_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "useracct": {"columns": [[0, "u_id", "INTEGER", 1, null, 1], [1, "name", "varchar(128)", 0, "NULL", 0]], "primary_keys": ["u_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "trust": {"columns": [[0, "source_u_id", "INTEGER", 1, null, 0], [1, "target_u_id", "INTEGER", 1, null, 0], [2, "trust", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "useracct", "target_u_id", "u_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "useracct", "source_u_id", "u_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}}
CREATE TABLE item (
    i_id INTEGER NOT NULL  PRIMARY KEY,
    title varchar(20)  DEFAULT NULL
);

CREATE TABLE review (
    a_id INTEGER NOT NULL  PRIMARY KEY,
    u_id INTEGER NOT NULL,
    i_id INTEGER NOT NULL,
    rating INTEGER  DEFAULT NULL,
    rank INTEGER  DEFAULT NULL,
    FOREIGN KEY (i_id) REFERENCES item(i_id),
    FOREIGN KEY (u_id) REFERENCES useracct(u_id)
);

CREATE TABLE useracct (
    u_id INTEGER NOT NULL  PRIMARY KEY,
    name varchar(128)  DEFAULT NULL
);

CREATE TABLE trust (
    source_u_id INTEGER NOT NULL,
    target_u_id INTEGER NOT NULL,
    trust INTEGER NOT NULL,
    FOREIGN KEY (target_u_id) REFERENCES useracct(u_id),
    FOREIGN KEY (source_u_id) REFERENCES useracct(u_id)
);