small bug in zotero.sqlite schema
sqlite> .schema ItemAttachments
CREATE TABLE itemAttachments (
itemID INTEGER PRIMARY KEY,
sourceItemID INT,
linkMode INT,
mimeType TEXT,
charsetID INT,
path TEXT,
originalPath TEXT,
FOREIGN KEY (itemID) REFERENCES items(itemID),
FOREIGN KEY (sourceItemID) REFERENCES items(sourceItemID)
);
CREATE INDEX itemAttachments_mimeType ON itemAttachments(mimeType);
CREATE INDEX itemAttachments_sourceItemID ON itemAttachments(sourceItemID);
#####
the line FOREIGN KEY (sourceItemID) REFERENCES items(sourceItemID)
should be:
FOREIGN KEY (sourceItemID) REFERENCES items(itemID)
CREATE TABLE itemAttachments (
itemID INTEGER PRIMARY KEY,
sourceItemID INT,
linkMode INT,
mimeType TEXT,
charsetID INT,
path TEXT,
originalPath TEXT,
FOREIGN KEY (itemID) REFERENCES items(itemID),
FOREIGN KEY (sourceItemID) REFERENCES items(sourceItemID)
);
CREATE INDEX itemAttachments_mimeType ON itemAttachments(mimeType);
CREATE INDEX itemAttachments_sourceItemID ON itemAttachments(sourceItemID);
#####
the line FOREIGN KEY (sourceItemID) REFERENCES items(sourceItemID)
should be:
FOREIGN KEY (sourceItemID) REFERENCES items(itemID)
-
dstillmanFixed, thanks.