Creates a new Schema object to check that the existing schema is one that the running server understands. If upgrade is true (which it is not, by default) and the schema is too old, it will be upgraded. (If upgrade is false, a "please upgrade" message will be issued.)

If commit is false (which it also is not, by default), the SQL statements performed during the upgrade will not be COMMITted, but their success or failure will be reported.

The owner will be notified of progress via the Query returned by result().

void Schema::execute()

Given an error message s and, optionally, the query q that caused the error, this private helper function logs a suitable set of Disaster messages (including the Query::description()) and sets the error message for d->result to s.

bool Schema::stepTo29()

bool Schema::stepTo3()

bool Schema::stepTo30()

bool Schema::stepTo31()

Add indexes on addresses and deleted_messages.

bool Schema::stepTo32()

The address_fields table lacks many of the rows it should have had in revisions prior to 33. This upgrade removes all existing rows, adds a new column with data we need to keep, parses header_fields to generate the new rows, and kills the now unnecessary header_fields rows.

Well, actually it doesn't do the last step yet. The MessageHeaderFetcher is careful to disregard these rows, so the do no harm.

bool Schema::stepTo33()

Add some indexes to speed up message deletion.

bool Schema::stepTo34()

Add tried_at to deliveries.

bool Schema::stepTo35()

Add sender to deliveries too.

bool Schema::stepTo36()

Grant "update" on deliveries to aox, because although stepTo28() did that, schema/grant-privileges did not.

bool Schema::stepTo37()

Create the unparsed_messages table if it doesn't exist already. After this revision, the table exists, but is unfilled; and the upgraded schema and schema.pg ought to be in sync.

bool Schema::stepTo38()

Grant insert on unparsed_messages.

bool Schema::stepTo39()

Add a unique constraint to scripts.

bool Schema::stepTo4()

Move message flags from the messages table to the extra_flags table, now renamed just "flags".

bool Schema::stepTo63()

bool Schema::stepTo64()

bool Schema::stepTo65()

Grant "update" on threads to aox, so that the threader can lock the table in exclusive mode.

bool Schema::stepTo66()

Change the unique constraint on threads to include "mailbox".

bool Schema::stepTo67()

Create a couple of new indexes to make "aox vacuum" faster, and help to look for specific message-ids.

bool Schema::stepTo68()

Add a table to log connections.

bool Schema::stepTo69()

Make subscriptions:(owner,mailbox) unique.

bool Schema::stepTo7()

Add header_fields.position.

bool Schema::stepTo70()

Add a table to refer to mailboxes that sieve scripts depend on.

bool Schema::stepTo71()

Grant some missing privileges. Sigh.

bool Schema::stepTo72()

Fix incorrect 2.09 EXPUNGEs.

bool Schema::stepTo73()

Split connections.client into address/port.

bool Schema::stepTo74()

Make bodyparts.hash non-unique.

bool Schema::stepTo75()

...but don't make it non-indexed.

bool Schema::stepTo76()

Add an index on d_m(mailbox,modseq) plus a couple of cleanups.

bool Schema::stepTo77()

Add an ldapdn column to users (if it doesn't already exist).

3.0.3/schema.pg was mistakenly released with mailstore.revision=76, but with all the changes from schema #77. So fresh installations of 3.0.3 will later try to execute stepTo77(), and we need to silently succeed if there's nothing to do.

bool Schema::stepTo80()

bool Schema::stepTo81()

aoximport and perhaps other code could create mailboxes such as /users/foo/stuff without knowing that /users/foo is someone's home, and therefore the new mailbox should be owned by foo.

bool Schema::stepTo82()

Installs a trigger to prevent deleting mailboxes that have to be there for one reason or another.

What we really want is to delete the mail in the mailbox when the mailbox is deleted, but to do that we need (at a minimum) the responsible user. So what we must do is prevent the deletion, and in the application code we must delete the messages before deleting the mailbox.

However, if any bad mailboxes already exist (as they do, not sure why) then aox upgrade schema can delete any mail them. aox upgrade schema knows who ran it.

bool Schema::stepTo83()

Move the Seen and Deleted flags into mailbox_messages, where we can test them much faster.

bool Schema::stepTo84()

Add a retention_policies table for use by "aox set/show retention".

bool Schema::stepTo85()

Starting with schema 80, we want aox upgrade schema to be able to downgrade. We do that by storing downgrade functions in the database. This schema adds the first few.

bool Schema::stepTo86()

We want to cache retention_policies rows. For that to work we have to clear the cache when a new row is added or one is deleted.

bool Schema::stepTo87()

Materialise internal nodes in the mailbox tree.

bool Schema::stepTo88()

Make users.alias nullable to help "aox delete user".

bool Schema::stepTo89()

Change connections.userid to username to help "aox delete user".

bool Schema::stepTo9()

Remove the recent_messages table altogether.

bool Schema::stepTo90()

Add a deliveries column so we can deliver mail later, not now.

bool Schema::stepTo91()

Nothing. Needed so that the right downgrade_to_ functions are written (they were bad in schema 90).

bool Schema::stepTo92()

Reintroduce connections.userid, for logging (only).

bool Schema::stepTo93()

Add users.quota, and set it to the 31-bit int_max. A bigger value might tickle some clients, and a smaller value should really not be the default.