This is perhaps the most central table in the entire database. For every message which is visible in a mailbox, there is a row in this table. (Some messages aren't visible, usually because they've just been deleted and not yet cleaned up. Others are visible in more than one mailbox, and so have more than one mailbox_messages rows.)
The uid column is the message's number in this mailbox. Whenever a message is added to a mailbox, it receives a number larger than all other messages in the mailbox. (This is initialised from mailboxes.uidnext.)
The modseq is a change counter. Whenever a message's flags or annotations change, Archiveopteryx increases modseq. Smart IMAP clients can use this with CONDSTORE to save bandwidth.
The seen and deleted columns store the IMAP \Seen and \Deleted flags. Most flags are stored in the flags table, but these two are used so much that we keep them here for performance.
create table mailbox_messages ( -- Grant: select, insert, update mailbox integer not null references mailboxes(id), uid integer not null, message integer not null references messages(id), modseq bigint not null, seen boolean not null default false, deleted boolean not null default false, primary key (mailbox, uid) );
The mailbox_messages table was introduced in version 2.06.
In case of questions, please write to firstname.lastname@example.org.
Last modified: 2010-11-19