Remove SQLHeavy: Closes #5034

It is done.

Initial implementation of the new database subsystem

These pieces represent the foundation for ticket #5034

Expanded transactions, added VersionedDatabase

Further expansions of the async code.

Moved async pool logic into Database, where it realistically
belongs.

Further improvements.  Introduced geary-db-test.

Added SQL create and update files for Geary.Db

version-001 to version-003 are exact copies of the SQLHeavy scripts
to ensure no slight changes when migrating.  version-004 upgrades
the database to remove the ImapFolderPropertiesTable and
ImapMessagePropertiesTable, now that the database code is pure
IMAP.

When we support other messaging systems (such as POP3), those
subsystems will need to code their own database layers OR rely on
the IMAP schema and simply ignore the IMAP-specific fields.

ImapDB.Account fleshed out

ImapDB.Folder is commented out, however.  Need to port next.

ImapDB.Folder fleshed out

MessageTable, MessageLocationTable, and AttachementTable are now
handled inside ImapDB.Folder.

chmod -x imap-db-database.vala

OutboxEmailIdentifier/Properties -> SmtpOutboxEmailIdentifier/Properties

Moved SmtpOutboxFolderRoot into its own source file

SmtpOutboxFolder ported to new database code

Move Engine implementations to ImapDB.

Integration and cleanup of new database code with main source

This commit performs the final integration steps to move Geary
completely over to the new database model.  This also cleans out
the old SQLHeavy-based code and fixes a handful of small bugs that
were detected during basic test runs.

Moved Outbox to ImapDB

As the Outbox is tied to the database that ImapDB runs, move the
Outbox code into that folder.

Outbox fixes and better parameter checking

Bumped Database thread pool count and made them exclusive

My reasoning is that there may be a need for a lot of threads at
once (when a big batch of commands comes in, especially at
startup).  If performance looks ok, we might consider relaxing
this later.
This commit is contained in:
Jim Nelson 2012-06-14 14:47:53 -07:00
parent bbc0da0b39
commit 0e2a533438
79 changed files with 4492 additions and 3865 deletions

97
sql/version-001.sql Normal file
View file

@ -0,0 +1,97 @@
--
-- FolderTable
--
CREATE TABLE FolderTable (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
parent_id INTEGER REFERENCES FolderTable ON DELETE RESTRICT
);
CREATE INDEX FolderTableNameIndex ON FolderTable(name);
CREATE INDEX FolderTableParentIndex ON FolderTable(parent_id);
--
-- MessageTable
--
CREATE TABLE MessageTable (
id INTEGER PRIMARY KEY,
fields INTEGER,
date_field TEXT,
date_time_t INTEGER,
from_field TEXT,
sender TEXT,
reply_to TEXT,
to_field TEXT,
cc TEXT,
bcc TEXT,
message_id TEXT,
in_reply_to TEXT,
reference_ids TEXT,
subject TEXT,
header TEXT,
body TEXT,
preview TEXT
);
CREATE INDEX MessageTableMessageIDIndex ON MessageTable(message_id);
--
-- MessageLocationTable
--
CREATE TABLE MessageLocationTable (
id INTEGER PRIMARY KEY,
message_id INTEGER REFERENCES MessageTable ON DELETE CASCADE,
folder_id INTEGER REFERENCES FolderTable ON DELETE CASCADE,
ordering INTEGER,
remove_marker INTEGER DEFAULT 0
);
CREATE INDEX MessageLocationTableMessageIDIndex ON MessageLocationTable(message_id);
CREATE INDEX MessageLocationTableFolderIDIndex ON MessageLocationTable(folder_id);
CREATE INDEX MessageLocationTableOrderingIndex ON MessageLocationTable(ordering ASC);
--
-- IMAP-specific tables
--
--
-- ImapFolderPropertiesTable
--
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
);
CREATE INDEX ImapFolderPropertiesTableFolderIDIndex ON ImapFolderPropertiesTable(folder_id);
--
-- ImapMessagePropertiesTable
--
CREATE TABLE ImapMessagePropertiesTable (
id INTEGER PRIMARY KEY,
message_id INTEGER UNIQUE REFERENCES MessageTable ON DELETE CASCADE,
flags TEXT,
internaldate TEXT,
rfc822_size INTEGER
);
CREATE INDEX ImapMessagePropertiesTableMessageIDIndex ON ImapMessagePropertiesTable(message_id);