See the ticket (comment #2) for more information on the thinking and strategy here, but in a nutshell this will remove from the Geary database all emails no longer accessible via any folder and not seen on the server in over 30 days. It also deletes those messages attachment(s) and removes any empty directories in the attachment/ directory to prevent clutter. If enough messages are garbage collected, Geary will vacuum the database at startup, which will lower its disk footprint and reduce fragmentation, potentially increasing performance.
25 lines
900 B
SQL
25 lines
900 B
SQL
--
|
|
-- 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);
|
|
|