Further work on detecting message removal when folder first selected: #3805

Needed to rethink storage strategies as I researched this and realized that a true scarce database -- where the database is sparsely populated both in columns and rows -- is not feasible due to IMAP's UID rules.  The strategy now means that the database rows are contiguous from the highest (newest) message to the oldest *requested by the user*.  This is a better situation than having to download the UID for the entire folder.
This commit is contained in:
Jim Nelson 2011-07-15 13:39:02 -07:00
parent 6b8951bfd8
commit 0533bc9700
45 changed files with 1078 additions and 412 deletions

View file

@ -51,11 +51,12 @@ CREATE TABLE MessageLocationTable (
id INTEGER PRIMARY KEY,
message_id INTEGER REFERENCES MessageTable ON DELETE CASCADE,
folder_id INTEGER REFERENCES FolderTable ON DELETE CASCADE,
position INTEGER
ordering INTEGER
);
CREATE INDEX MessageLocationTableMessageIDIndex ON MessageLocationTable(message_id);
CREATE INDEX MessageLocationTableFolderIDIndex ON MessageLocationTable(folder_id);
CREATE INDEX MessageLocationTableOrderingIndex ON MessageLocationTable(ordering ASC);
--
-- IMAP-specific tables
@ -68,7 +69,9 @@ CREATE INDEX MessageLocationTableFolderIDIndex ON MessageLocationTable(folder_id
CREATE TABLE ImapFolderPropertiesTable (
id INTEGER PRIMARY KEY,
folder_id INTEGER UNIQUE REFERENCES FolderTable ON DELETE CASCADE,
last_seen_total INTEGER,
uid_validity INTEGER,
uid_next INTEGER,
attributes TEXT
);
@ -81,20 +84,10 @@ CREATE INDEX ImapFolderPropertiesTableFolderIDIndex ON ImapFolderPropertiesTable
CREATE TABLE ImapMessagePropertiesTable (
id INTEGER PRIMARY KEY,
message_id INTEGER UNIQUE REFERENCES MessageTable ON DELETE CASCADE,
flags TEXT
flags TEXT,
internaldate TEXT,
rfc822_size INTEGER
);
CREATE INDEX ImapMessagePropertiesTableMessageIDIndex ON ImapMessagePropertiesTable(message_id);
--
-- ImapMessageLocationPropertiesTable
--
CREATE TABLE ImapMessageLocationPropertiesTable (
id INTEGER PRIMARY KEY,
location_id INTEGER UNIQUE REFERENCES MessageLocationTable ON DELETE CASCADE,
uid INTEGER
);
CREATE INDEX ImapMessageLocationPropertiesTableLocationIDIndex ON ImapMessageLocationPropertiesTable(location_id);