=== modified file 'CMakeLists.txt' --- CMakeLists.txt 2016-02-17 01:21:06 +0000 +++ CMakeLists.txt 2016-02-21 19:46:31 +0000 @@ -66,9 +66,9 @@ add_custom_target( uninstall-base - COMMAND + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake - COMMAND + COMMAND ${glib_schema_compiler} ${GSETTINGS_DIR} ) @@ -90,7 +90,7 @@ # This generates the dist tarballs add_custom_target( dist - COMMAND + COMMAND git archive --prefix=${ARCHIVE_BASE_NAME}/ HEAD | xz -z > ${CMAKE_BINARY_DIR}/${ARCHIVE_FULL_NAME} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} @@ -98,6 +98,4 @@ add_subdirectory(data) add_subdirectory(po) -add_subdirectory(sql) add_subdirectory(src) - === modified file 'data/CMakeLists.txt' --- data/CMakeLists.txt 2016-02-17 18:59:49 +0000 +++ data/CMakeLists.txt 2016-02-21 19:47:09 +0000 @@ -21,13 +21,13 @@ CODE "message (STATUS \"Updating desktop database\")" ) - + add_custom_target( uninstall-desktop-update COMMAND update-desktop-database ) - + add_dependencies(post-uninstall uninstall-desktop-update) else () install( @@ -37,3 +37,4 @@ add_subdirectory(theming) add_subdirectory(ui) +add_subdirectory(sql) === added directory 'data/sql' === added file 'data/sql/CMakeLists.txt' --- data/sql/CMakeLists.txt 1970-01-01 00:00:00 +0000 +++ data/sql/CMakeLists.txt 2016-02-21 19:45:29 +0000 @@ -0,0 +1,26 @@ +set(SQL_DEST share/${CMAKE_PROJECT_NAME}/sql) + +install(FILES version-001.sql DESTINATION ${SQL_DEST}) +install(FILES version-002.sql DESTINATION ${SQL_DEST}) +install(FILES version-003.sql DESTINATION ${SQL_DEST}) +install(FILES version-004.sql DESTINATION ${SQL_DEST}) +install(FILES version-005.sql DESTINATION ${SQL_DEST}) +install(FILES version-006.sql DESTINATION ${SQL_DEST}) +install(FILES version-007.sql DESTINATION ${SQL_DEST}) +install(FILES version-008.sql DESTINATION ${SQL_DEST}) +install(FILES version-009.sql DESTINATION ${SQL_DEST}) +install(FILES version-010.sql DESTINATION ${SQL_DEST}) +install(FILES version-011.sql DESTINATION ${SQL_DEST}) +install(FILES version-012.sql DESTINATION ${SQL_DEST}) +install(FILES version-013.sql DESTINATION ${SQL_DEST}) +install(FILES version-014.sql DESTINATION ${SQL_DEST}) +install(FILES version-015.sql DESTINATION ${SQL_DEST}) +install(FILES version-016.sql DESTINATION ${SQL_DEST}) +install(FILES version-017.sql DESTINATION ${SQL_DEST}) +install(FILES version-018.sql DESTINATION ${SQL_DEST}) +install(FILES version-019.sql DESTINATION ${SQL_DEST}) +install(FILES version-020.sql DESTINATION ${SQL_DEST}) +install(FILES version-021.sql DESTINATION ${SQL_DEST}) +install(FILES version-022.sql DESTINATION ${SQL_DEST}) +install(FILES version-023.sql DESTINATION ${SQL_DEST}) +install(FILES version-024.sql DESTINATION ${SQL_DEST}) === added file 'data/sql/version-001.sql' --- data/sql/version-001.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-001.sql 2016-02-21 19:45:29 +0000 @@ -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); + === added file 'data/sql/version-002.sql' --- data/sql/version-002.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-002.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,15 @@ + +-- +-- MessageAttachmentTable +-- + +CREATE TABLE MessageAttachmentTable ( + id INTEGER PRIMARY KEY, + message_id INTEGER REFERENCES MessageTable ON DELETE CASCADE, + filename TEXT, + mime_type TEXT, + filesize INTEGER +); + +CREATE INDEX MessageAttachmentTableMessageIDIndex ON MessageAttachmentTable(message_id); + === added file 'data/sql/version-003.sql' --- data/sql/version-003.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-003.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,13 @@ + +-- +-- SmtpOutboxTable +-- + +CREATE TABLE SmtpOutboxTable ( + id INTEGER PRIMARY KEY, + ordering INTEGER, + message TEXT +); + +CREATE INDEX SmtpOutboxOrderingIndex ON SmtpOutboxTable(ordering ASC); + === added file 'data/sql/version-004.sql' --- data/sql/version-004.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-004.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,42 @@ + +-- +-- Migrate ImapFolderPropertiesTable into FolderTable +-- + +ALTER TABLE FolderTable ADD COLUMN last_seen_total INTEGER; +ALTER TABLE FolderTable ADD COLUMN uid_validity INTEGER; +ALTER TABLE FolderTable ADD COLUMN uid_next INTEGER; +ALTER TABLE FolderTable ADD COLUMN attributes TEXT; + +UPDATE FolderTable + SET + last_seen_total = (SELECT ImapFolderPropertiesTable.last_seen_total FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id), + uid_validity = (SELECT ImapFolderPropertiesTable.uid_validity FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id), + uid_next = (SELECT ImapFolderPropertiesTable.uid_next FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id), + attributes = (SELECT ImapFolderPropertiesTable.attributes FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id) + WHERE EXISTS + (SELECT * FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id); + +DROP TABLE ImapFolderPropertiesTable; + +-- +-- Migrate ImapMessagePropertiesTable into MessageTable +-- + +ALTER TABLE MessageTable ADD COLUMN flags TEXT; +ALTER TABLE MessageTable ADD COLUMN internaldate TEXT; +ALTER TABLE MessageTable ADD COLUMN rfc822_size INTEGER; + +CREATE INDEX MessageTableInternalDateIndex ON MessageTable(internaldate); +CREATE INDEX MessageTableRfc822SizeIndex ON MessageTable(rfc822_size); + +UPDATE MessageTable + SET + flags = (SELECT ImapMessagePropertiesTable.flags FROM ImapMessagePropertiesTable WHERE ImapMessagePropertiesTable.message_id = MessageTable.id), + internaldate = (SELECT ImapMessagePropertiesTable.internaldate FROM ImapMessagePropertiesTable WHERE ImapMessagePropertiesTable.message_id = MessageTable.id), + rfc822_size = (SELECT ImapMessagePropertiesTable.rfc822_size FROM ImapMessagePropertiesTable WHERE ImapMessagePropertiesTable.message_id = MessageTable.ID) + WHERE EXISTS + (SELECT * FROM ImapMessagePropertiesTable WHERE ImapMessagePropertiesTable.message_id = MessageTable.id); + +DROP TABLE ImapMessagePropertiesTable; + === added file 'data/sql/version-005.sql' --- data/sql/version-005.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-005.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,13 @@ + +-- +-- Create ContactTable for autocompletion contacts. Data is migrated in vala upgrade hooks. +-- + +CREATE TABLE ContactTable ( + id INTEGER PRIMARY KEY, + normalized_email TEXT NOT NULL, + real_name TEXT, + email TEXT UNIQUE NOT NULL, + highest_importance INTEGER NOT NULL +); + === added file 'data/sql/version-006.sql' --- data/sql/version-006.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-006.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,7 @@ +-- +-- Dummy database upgrade to fix folder names being stored in encoded form. +-- Before this version, all folder names are stored as they came off the wire. +-- After this version, all folder names are stored in canonical UTF-8 form. +-- See src/engine/imap-db/imap-db-database.vala in post_upgrade() for the code +-- that runs the upgrade. +-- === added file 'data/sql/version-007.sql' --- data/sql/version-007.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-007.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,9 @@ +-- +-- Gmail has a serious bug: its STATUS command returns a message count that includes chat messages, +-- but the SELECT/EXAMINE result codes do not. That means its difficult to confirm changes to a +-- mailbox without SELECTing it each pass. This schema modification allows for Geary to store both +-- the SELECT/EXAMINE count and STATUS count in the database for comparison. +-- + +ALTER TABLE FolderTable ADD COLUMN last_seen_status_total; + === added file 'data/sql/version-008.sql' --- data/sql/version-008.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-008.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,5 @@ +-- +-- Index the in_reply_to column, since we're searching on it now. +-- + +CREATE INDEX MessageTableInReplyToIndex ON MessageTable(in_reply_to); === added file 'data/sql/version-009.sql' --- data/sql/version-009.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-009.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,6 @@ +-- +-- Add flags column to the ContactTable +-- + +ALTER TABLE ContactTable ADD COLUMN flags TEXT; + === added file 'data/sql/version-010.sql' --- data/sql/version-010.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-010.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,5 @@ +-- +-- Add unread count column to the FolderTable +-- + +ALTER TABLE FolderTable ADD COLUMN unread_count INTEGER DEFAULT 0; === added file 'data/sql/version-011.sql' --- data/sql/version-011.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-011.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,5 @@ +-- +-- Dummy database upgrade to add MessageSearchTable, whose parameters depend on +-- things we need at run-time. See src/engine/imap-db/imap-db-database.vala in +-- post_upgrade() for the code that runs the upgrade. +-- === added file 'data/sql/version-012.sql' --- data/sql/version-012.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-012.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,7 @@ +-- +-- Add the internaldate column as a time_t value so we can sort on it. +-- + +ALTER TABLE MessageTable ADD COLUMN internaldate_time_t INTEGER; + +CREATE INDEX MessageTableInternalDateTimeTIndex ON MessageTable(internaldate_time_t); === added file 'data/sql/version-013.sql' --- data/sql/version-013.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-013.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,9 @@ +-- +-- Add the disposition column as a string so the client can decide which attachments to show. +-- Since all attachments up to this point have been non-inline, set it to that value (which +-- is defined in src/engine/api/geary-attachment.vala +-- + +ALTER TABLE MessageAttachmentTable ADD COLUMN disposition INTEGER; +UPDATE MessageAttachmentTable SET disposition=0; + === added file 'data/sql/version-014.sql' --- data/sql/version-014.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-014.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,4 @@ +-- +-- Dummy file to upgrade to version 14. See imap-db-database.vala for the +-- actual code that gets executed here. +-- === added file 'data/sql/version-015.sql' --- data/sql/version-015.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-015.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,6 @@ +-- +-- Dummy database upgrade to fix the INTERNALDATE of messages that were accidentally stored in +-- localized format. See src/engine/imap-db/imap-db-database.vala in post_upgrade() for the code +-- that runs the upgrade, and http://redmine.yorba.org/issues/7354 for more information. +-- + === added file 'data/sql/version-016.sql' --- data/sql/version-016.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-016.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,9 @@ +-- +-- For a while there, we weren't properly indexing attachment filenames in the +-- search table. To be proper (and since this is right before a major release) +-- we want to make sure anyone who's been running the dailies has a good +-- database, which unfortunately means ditching the search table and letting +-- Geary recreate it properly. +-- + +DELETE FROM MessageSearchTable === added file 'data/sql/version-017.sql' --- data/sql/version-017.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-017.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,7 @@ +-- +-- We're now keeping sent mail around after sending, so we can also push it up +-- to the Sent Mail folder. This column lets us keep track of the state of +-- messages in the outbox. +-- + +ALTER TABLE SmtpOutboxTable ADD COLUMN sent INTEGER DEFAULT 0; === added file 'data/sql/version-018.sql' --- data/sql/version-018.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-018.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,4 @@ +-- +-- Dummy upgrade to nuke the internaldate_time_t column, because it had the +-- wrong values. It'll be repopulated in code, in imap-db-database.vala. +-- === added file 'data/sql/version-019.sql' --- data/sql/version-019.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-019.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,5 @@ +-- +-- Dummy database upgrade to validate contact email addresses. See +-- src/engine/imap-db/imap-db-database.vala in post_upgrade() for the code +-- that runs the upgrade. +-- === added file 'data/sql/version-020.sql' --- data/sql/version-020.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-020.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,7 @@ +-- +-- We had previously incorrectly included an id column in the search table. +-- The code is fixed to use docid instead, so we just empty the table and let +-- the natural search table population process make things right. +-- + +DELETE FROM MessageSearchTable === added file 'data/sql/version-021.sql' --- data/sql/version-021.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-021.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,13 @@ +-- +-- Some queries that hit the MessageLocationTable, like those used by the email +-- prefetcher, were slow because we didn't have a covering index. This makes +-- an index that *is* covering, for the cases in question anyway. Since we +-- (should) never care about ordering without folder_id, and since folder_id +-- comes first here so this index effectively indexes queries on just that +-- field too, we can also drop the old, ineffective indices. +-- + +DROP INDEX MessageLocationTableFolderIdIndex; +DROP INDEX MessageLocationTableOrderingIndex; +CREATE INDEX MessageLocationTableFolderIDOrderingIndex + ON MessageLocationTable(folder_id, ordering); === added file 'data/sql/version-022.sql' --- data/sql/version-022.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-022.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,10 @@ +-- +-- Database upgrade to repopulate attachments. Bug #713830 revealed that +-- non-text and non-image files with no Content-Disposition were being dropped. +-- Also add Content-ID to database so attachments in RCF822 messages can be paired +-- to extracted attachments on filesystem. +-- + +ALTER TABLE MessageAttachmentTable ADD COLUMN content_id TEXT DEFAULT NULL; +ALTER TABLE MessageAttachmentTable ADD COLUMN description TEXT DEFAULT NULL; + === added file 'data/sql/version-023.sql' --- data/sql/version-023.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-023.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,21 @@ +-- +-- Database upgrade to add FTS tokenize virtual table, which allows for querying the tokenizer +-- directly for stemmed words, and dropping the stemmed FTS table for an unstemmed one. We now +-- use the stemmer manually to generate search queries. +-- + +DROP TABLE MessageSearchTable; + +CREATE VIRTUAL TABLE MessageSearchTable USING fts4( + body, + attachment, + subject, + from_field, + receivers, + cc, + bcc, + + tokenize=simple, + prefix="2,4,6,8,10" +); + === added file 'data/sql/version-024.sql' --- data/sql/version-024.sql 1970-01-01 00:00:00 +0000 +++ data/sql/version-024.sql 2016-02-21 19:45:29 +0000 @@ -0,0 +1,25 @@ +-- +-- Add the DeleteAttachmentFile table, which allows for attachment files to be deleted (garbage +-- collected) after all references to them have been removed from the database without worrying +-- about deleting them first and the database transaction failing. +-- +-- Also add GarbageCollectionTable, a single-row table holding various information about when +-- GC has occurred and when it should occur next. +-- + +CREATE TABLE DeleteAttachmentFileTable ( + id INTEGER PRIMARY KEY, + filename TEXT NOT NULL +); + +CREATE TABLE GarbageCollectionTable ( + id INTEGER PRIMARY KEY, + last_reap_time_t INTEGER DEFAULT NULL, + last_vacuum_time_t INTEGER DEFAULT NULL, + reaped_messages_since_last_vacuum INTEGER DEFAULT 0 +); + +-- Insert a single row with a well-known rowid and default values, this will be the row used +-- by the ImapDB.GC class. +INSERT INTO GarbageCollectionTable (id) VALUES (0); + === removed directory 'sql' === removed file 'sql/CMakeLists.txt' --- sql/CMakeLists.txt 2016-02-17 01:21:06 +0000 +++ sql/CMakeLists.txt 1970-01-01 00:00:00 +0000 @@ -1,26 +0,0 @@ -set(SQL_DEST share/${CMAKE_PROJECT_NAME}/sql) - -install(FILES version-001.sql DESTINATION ${SQL_DEST}) -install(FILES version-002.sql DESTINATION ${SQL_DEST}) -install(FILES version-003.sql DESTINATION ${SQL_DEST}) -install(FILES version-004.sql DESTINATION ${SQL_DEST}) -install(FILES version-005.sql DESTINATION ${SQL_DEST}) -install(FILES version-006.sql DESTINATION ${SQL_DEST}) -install(FILES version-007.sql DESTINATION ${SQL_DEST}) -install(FILES version-008.sql DESTINATION ${SQL_DEST}) -install(FILES version-009.sql DESTINATION ${SQL_DEST}) -install(FILES version-010.sql DESTINATION ${SQL_DEST}) -install(FILES version-011.sql DESTINATION ${SQL_DEST}) -install(FILES version-012.sql DESTINATION ${SQL_DEST}) -install(FILES version-013.sql DESTINATION ${SQL_DEST}) -install(FILES version-014.sql DESTINATION ${SQL_DEST}) -install(FILES version-015.sql DESTINATION ${SQL_DEST}) -install(FILES version-016.sql DESTINATION ${SQL_DEST}) -install(FILES version-017.sql DESTINATION ${SQL_DEST}) -install(FILES version-018.sql DESTINATION ${SQL_DEST}) -install(FILES version-019.sql DESTINATION ${SQL_DEST}) -install(FILES version-020.sql DESTINATION ${SQL_DEST}) -install(FILES version-021.sql DESTINATION ${SQL_DEST}) -install(FILES version-022.sql DESTINATION ${SQL_DEST}) -install(FILES version-023.sql DESTINATION ${SQL_DEST}) -install(FILES version-024.sql DESTINATION ${SQL_DEST}) === removed file 'sql/version-001.sql' --- sql/version-001.sql 2012-07-11 22:40:39 +0000 +++ sql/version-001.sql 1970-01-01 00:00:00 +0000 @@ -1,97 +0,0 @@ - --- --- 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); - === removed file 'sql/version-002.sql' --- sql/version-002.sql 2012-07-11 22:40:39 +0000 +++ sql/version-002.sql 1970-01-01 00:00:00 +0000 @@ -1,15 +0,0 @@ - --- --- MessageAttachmentTable --- - -CREATE TABLE MessageAttachmentTable ( - id INTEGER PRIMARY KEY, - message_id INTEGER REFERENCES MessageTable ON DELETE CASCADE, - filename TEXT, - mime_type TEXT, - filesize INTEGER -); - -CREATE INDEX MessageAttachmentTableMessageIDIndex ON MessageAttachmentTable(message_id); - === removed file 'sql/version-003.sql' --- sql/version-003.sql 2012-07-11 22:40:39 +0000 +++ sql/version-003.sql 1970-01-01 00:00:00 +0000 @@ -1,13 +0,0 @@ - --- --- SmtpOutboxTable --- - -CREATE TABLE SmtpOutboxTable ( - id INTEGER PRIMARY KEY, - ordering INTEGER, - message TEXT -); - -CREATE INDEX SmtpOutboxOrderingIndex ON SmtpOutboxTable(ordering ASC); - === removed file 'sql/version-004.sql' --- sql/version-004.sql 2012-07-11 22:40:39 +0000 +++ sql/version-004.sql 1970-01-01 00:00:00 +0000 @@ -1,42 +0,0 @@ - --- --- Migrate ImapFolderPropertiesTable into FolderTable --- - -ALTER TABLE FolderTable ADD COLUMN last_seen_total INTEGER; -ALTER TABLE FolderTable ADD COLUMN uid_validity INTEGER; -ALTER TABLE FolderTable ADD COLUMN uid_next INTEGER; -ALTER TABLE FolderTable ADD COLUMN attributes TEXT; - -UPDATE FolderTable - SET - last_seen_total = (SELECT ImapFolderPropertiesTable.last_seen_total FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id), - uid_validity = (SELECT ImapFolderPropertiesTable.uid_validity FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id), - uid_next = (SELECT ImapFolderPropertiesTable.uid_next FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id), - attributes = (SELECT ImapFolderPropertiesTable.attributes FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id) - WHERE EXISTS - (SELECT * FROM ImapFolderPropertiesTable WHERE ImapFolderPropertiesTable.folder_id = FolderTable.id); - -DROP TABLE ImapFolderPropertiesTable; - --- --- Migrate ImapMessagePropertiesTable into MessageTable --- - -ALTER TABLE MessageTable ADD COLUMN flags TEXT; -ALTER TABLE MessageTable ADD COLUMN internaldate TEXT; -ALTER TABLE MessageTable ADD COLUMN rfc822_size INTEGER; - -CREATE INDEX MessageTableInternalDateIndex ON MessageTable(internaldate); -CREATE INDEX MessageTableRfc822SizeIndex ON MessageTable(rfc822_size); - -UPDATE MessageTable - SET - flags = (SELECT ImapMessagePropertiesTable.flags FROM ImapMessagePropertiesTable WHERE ImapMessagePropertiesTable.message_id = MessageTable.id), - internaldate = (SELECT ImapMessagePropertiesTable.internaldate FROM ImapMessagePropertiesTable WHERE ImapMessagePropertiesTable.message_id = MessageTable.id), - rfc822_size = (SELECT ImapMessagePropertiesTable.rfc822_size FROM ImapMessagePropertiesTable WHERE ImapMessagePropertiesTable.message_id = MessageTable.ID) - WHERE EXISTS - (SELECT * FROM ImapMessagePropertiesTable WHERE ImapMessagePropertiesTable.message_id = MessageTable.id); - -DROP TABLE ImapMessagePropertiesTable; - === removed file 'sql/version-005.sql' --- sql/version-005.sql 2012-08-16 23:07:43 +0000 +++ sql/version-005.sql 1970-01-01 00:00:00 +0000 @@ -1,13 +0,0 @@ - --- --- Create ContactTable for autocompletion contacts. Data is migrated in vala upgrade hooks. --- - -CREATE TABLE ContactTable ( - id INTEGER PRIMARY KEY, - normalized_email TEXT NOT NULL, - real_name TEXT, - email TEXT UNIQUE NOT NULL, - highest_importance INTEGER NOT NULL -); - === removed file 'sql/version-006.sql' --- sql/version-006.sql 2013-02-25 23:01:37 +0000 +++ sql/version-006.sql 1970-01-01 00:00:00 +0000 @@ -1,7 +0,0 @@ --- --- Dummy database upgrade to fix folder names being stored in encoded form. --- Before this version, all folder names are stored as they came off the wire. --- After this version, all folder names are stored in canonical UTF-8 form. --- See src/engine/imap-db/imap-db-database.vala in post_upgrade() for the code --- that runs the upgrade. --- === removed file 'sql/version-007.sql' --- sql/version-007.sql 2013-02-26 04:18:37 +0000 +++ sql/version-007.sql 1970-01-01 00:00:00 +0000 @@ -1,9 +0,0 @@ --- --- Gmail has a serious bug: its STATUS command returns a message count that includes chat messages, --- but the SELECT/EXAMINE result codes do not. That means its difficult to confirm changes to a --- mailbox without SELECTing it each pass. This schema modification allows for Geary to store both --- the SELECT/EXAMINE count and STATUS count in the database for comparison. --- - -ALTER TABLE FolderTable ADD COLUMN last_seen_status_total; - === removed file 'sql/version-008.sql' --- sql/version-008.sql 2013-03-11 21:34:33 +0000 +++ sql/version-008.sql 1970-01-01 00:00:00 +0000 @@ -1,5 +0,0 @@ --- --- Index the in_reply_to column, since we're searching on it now. --- - -CREATE INDEX MessageTableInReplyToIndex ON MessageTable(in_reply_to); === removed file 'sql/version-009.sql' --- sql/version-009.sql 2013-05-15 01:07:53 +0000 +++ sql/version-009.sql 1970-01-01 00:00:00 +0000 @@ -1,6 +0,0 @@ --- --- Add flags column to the ContactTable --- - -ALTER TABLE ContactTable ADD COLUMN flags TEXT; - === removed file 'sql/version-010.sql' --- sql/version-010.sql 2013-06-22 01:20:56 +0000 +++ sql/version-010.sql 1970-01-01 00:00:00 +0000 @@ -1,5 +0,0 @@ --- --- Add unread count column to the FolderTable --- - -ALTER TABLE FolderTable ADD COLUMN unread_count INTEGER DEFAULT 0; === removed file 'sql/version-011.sql' --- sql/version-011.sql 2013-06-25 00:54:41 +0000 +++ sql/version-011.sql 1970-01-01 00:00:00 +0000 @@ -1,5 +0,0 @@ --- --- Dummy database upgrade to add MessageSearchTable, whose parameters depend on --- things we need at run-time. See src/engine/imap-db/imap-db-database.vala in --- post_upgrade() for the code that runs the upgrade. --- === removed file 'sql/version-012.sql' --- sql/version-012.sql 2013-06-25 00:54:41 +0000 +++ sql/version-012.sql 1970-01-01 00:00:00 +0000 @@ -1,7 +0,0 @@ --- --- Add the internaldate column as a time_t value so we can sort on it. --- - -ALTER TABLE MessageTable ADD COLUMN internaldate_time_t INTEGER; - -CREATE INDEX MessageTableInternalDateTimeTIndex ON MessageTable(internaldate_time_t); === removed file 'sql/version-013.sql' --- sql/version-013.sql 2013-07-19 23:28:56 +0000 +++ sql/version-013.sql 1970-01-01 00:00:00 +0000 @@ -1,9 +0,0 @@ --- --- Add the disposition column as a string so the client can decide which attachments to show. --- Since all attachments up to this point have been non-inline, set it to that value (which --- is defined in src/engine/api/geary-attachment.vala --- - -ALTER TABLE MessageAttachmentTable ADD COLUMN disposition INTEGER; -UPDATE MessageAttachmentTable SET disposition=0; - === removed file 'sql/version-014.sql' --- sql/version-014.sql 2013-09-25 01:48:12 +0000 +++ sql/version-014.sql 1970-01-01 00:00:00 +0000 @@ -1,4 +0,0 @@ --- --- Dummy file to upgrade to version 14. See imap-db-database.vala for the --- actual code that gets executed here. --- === removed file 'sql/version-015.sql' --- sql/version-015.sql 2013-09-26 01:04:58 +0000 +++ sql/version-015.sql 1970-01-01 00:00:00 +0000 @@ -1,6 +0,0 @@ --- --- Dummy database upgrade to fix the INTERNALDATE of messages that were accidentally stored in --- localized format. See src/engine/imap-db/imap-db-database.vala in post_upgrade() for the code --- that runs the upgrade, and http://redmine.yorba.org/issues/7354 for more information. --- - === removed file 'sql/version-016.sql' --- sql/version-016.sql 2013-10-02 19:56:25 +0000 +++ sql/version-016.sql 1970-01-01 00:00:00 +0000 @@ -1,9 +0,0 @@ --- --- For a while there, we weren't properly indexing attachment filenames in the --- search table. To be proper (and since this is right before a major release) --- we want to make sure anyone who's been running the dailies has a good --- database, which unfortunately means ditching the search table and letting --- Geary recreate it properly. --- - -DELETE FROM MessageSearchTable === removed file 'sql/version-017.sql' --- sql/version-017.sql 2014-01-30 02:18:31 +0000 +++ sql/version-017.sql 1970-01-01 00:00:00 +0000 @@ -1,7 +0,0 @@ --- --- We're now keeping sent mail around after sending, so we can also push it up --- to the Sent Mail folder. This column lets us keep track of the state of --- messages in the outbox. --- - -ALTER TABLE SmtpOutboxTable ADD COLUMN sent INTEGER DEFAULT 0; === removed file 'sql/version-018.sql' --- sql/version-018.sql 2014-03-04 01:40:53 +0000 +++ sql/version-018.sql 1970-01-01 00:00:00 +0000 @@ -1,4 +0,0 @@ --- --- Dummy upgrade to nuke the internaldate_time_t column, because it had the --- wrong values. It'll be repopulated in code, in imap-db-database.vala. --- === removed file 'sql/version-019.sql' --- sql/version-019.sql 2014-02-21 23:00:57 +0000 +++ sql/version-019.sql 1970-01-01 00:00:00 +0000 @@ -1,5 +0,0 @@ --- --- Dummy database upgrade to validate contact email addresses. See --- src/engine/imap-db/imap-db-database.vala in post_upgrade() for the code --- that runs the upgrade. --- === removed file 'sql/version-020.sql' --- sql/version-020.sql 2014-03-12 23:39:22 +0000 +++ sql/version-020.sql 1970-01-01 00:00:00 +0000 @@ -1,7 +0,0 @@ --- --- We had previously incorrectly included an id column in the search table. --- The code is fixed to use docid instead, so we just empty the table and let --- the natural search table population process make things right. --- - -DELETE FROM MessageSearchTable === removed file 'sql/version-021.sql' --- sql/version-021.sql 2014-03-12 23:39:22 +0000 +++ sql/version-021.sql 1970-01-01 00:00:00 +0000 @@ -1,13 +0,0 @@ --- --- Some queries that hit the MessageLocationTable, like those used by the email --- prefetcher, were slow because we didn't have a covering index. This makes --- an index that *is* covering, for the cases in question anyway. Since we --- (should) never care about ordering without folder_id, and since folder_id --- comes first here so this index effectively indexes queries on just that --- field too, we can also drop the old, ineffective indices. --- - -DROP INDEX MessageLocationTableFolderIdIndex; -DROP INDEX MessageLocationTableOrderingIndex; -CREATE INDEX MessageLocationTableFolderIDOrderingIndex - ON MessageLocationTable(folder_id, ordering); === removed file 'sql/version-022.sql' --- sql/version-022.sql 2014-08-12 21:22:57 +0000 +++ sql/version-022.sql 1970-01-01 00:00:00 +0000 @@ -1,10 +0,0 @@ --- --- Database upgrade to repopulate attachments. Bug #713830 revealed that --- non-text and non-image files with no Content-Disposition were being dropped. --- Also add Content-ID to database so attachments in RCF822 messages can be paired --- to extracted attachments on filesystem. --- - -ALTER TABLE MessageAttachmentTable ADD COLUMN content_id TEXT DEFAULT NULL; -ALTER TABLE MessageAttachmentTable ADD COLUMN description TEXT DEFAULT NULL; - === removed file 'sql/version-023.sql' --- sql/version-023.sql 2014-12-16 20:26:31 +0000 +++ sql/version-023.sql 1970-01-01 00:00:00 +0000 @@ -1,21 +0,0 @@ --- --- Database upgrade to add FTS tokenize virtual table, which allows for querying the tokenizer --- directly for stemmed words, and dropping the stemmed FTS table for an unstemmed one. We now --- use the stemmer manually to generate search queries. --- - -DROP TABLE MessageSearchTable; - -CREATE VIRTUAL TABLE MessageSearchTable USING fts4( - body, - attachment, - subject, - from_field, - receivers, - cc, - bcc, - - tokenize=simple, - prefix="2,4,6,8,10" -); - === removed file 'sql/version-024.sql' --- sql/version-024.sql 2014-12-19 01:00:47 +0000 +++ sql/version-024.sql 1970-01-01 00:00:00 +0000 @@ -1,25 +0,0 @@ --- --- Add the DeleteAttachmentFile table, which allows for attachment files to be deleted (garbage --- collected) after all references to them have been removed from the database without worrying --- about deleting them first and the database transaction failing. --- --- Also add GarbageCollectionTable, a single-row table holding various information about when --- GC has occurred and when it should occur next. --- - -CREATE TABLE DeleteAttachmentFileTable ( - id INTEGER PRIMARY KEY, - filename TEXT NOT NULL -); - -CREATE TABLE GarbageCollectionTable ( - id INTEGER PRIMARY KEY, - last_reap_time_t INTEGER DEFAULT NULL, - last_vacuum_time_t INTEGER DEFAULT NULL, - reaped_messages_since_last_vacuum INTEGER DEFAULT 0 -); - --- Insert a single row with a well-known rowid and default values, this will be the row used --- by the ImapDB.GC class. -INSERT INTO GarbageCollectionTable (id) VALUES (0); -