This page contains notes for users who are upgrading from one version of Decimail to another.
The basic procedure is:
In version 0.3 the view that finds subscribed IMAP mailboxes has been fixed. This is generated by the create_imap.sql script. This script also creates the table that stores IMAP message flags (seen, answered, deleted). If you re-run create_imap.sql all of these flags will be lost and everything will appear as seen, unanswered and undeleted. If this matters, you should instead regenerate the imap_subscribed_mailboxes view manually. Simply start psql, "drop view imap_subscribed_mailboxes;" and enter the "create view imap_subscribed_mailboxes" command from create_imap.sql manually.
Version 0.4 adds a daemon that deletes the backup files for messages that have been deleted from the database. If you want to keep these files permanently you should simply not install dmdeleted. If you do install it, note that it is triggered by notifications sent via that database when messages are deleted. Adding this has required a one-line addition to the function log_deleted_message in create_deletelog.sql. However, if you simply re-run create_deletelog.sql your log of already-deleted messages will be cleared. Instead you should manually replace the log_deleted_message function with the new version. Do this interactivly using psql and copy/paste the new code out of create_deletelog.sql, as follows:
Version 0.5 adds the actions framework and an example application of it to create an automatic People/ folder hierarchy. To add the actions framework to your system, run create_actions.sql. To add the new People/ folder hierarchy, replacing the old People/ folder based on address_info.sql, drop table address_info and run create_people.sql, then re-run mailboxes.sql.
The SQL files related to the Actions framework have moved to a new subdirectory of the sql directory, and include new hierarchies for per-domain, per-subject and per-label grouping. You can run these files to add those mailboxes.
The per-person hierarchy now shows To: and Cc: messages as well as From: messages. If you want to add this, do NOT run actions/people.sql unless you want it to delete your existing per-person mailbox definitions. To get the new functionality while retaining your existing mailboxes, replace the view people_mailboxes with the new version using copy-and-paste from people.sql. You'll then need to re-run mailboxes.sql.
No SQL has changed in this version, but you need to do the following as the PostgreSQL superuser:
You'll also need to add a new configuration setting to specify where the message backup files should go. (This was previously hardcoded.)
It's important that the value that you give ends with a /.
Not much SQL has changed in this version. If you were using the per-domain mailboxes and would like to make them more efficient, look at the new index messages_by_from_addr_domain in indexes.sql and the changes in sql/actions/domains.sql.
No SQL has changed in this version, so you don't need to touch your database at all. Just recompile the IMAP daemon.
The change in this version is the addition of text searching on message subjects using PostgreSQL's tsearch2 contrib module.
To add this functionality:
Some of those steps may take a while.
If you want to use the new actions framework code for mailing lists and/or spam mailboxes, first remove the old mailing list tables stuff and then run actions/spam.sql and actions/lists.sql. Then re-run mailboxes.sql to build a new mailboxes view that includes these new mailboxes.
You need to run realnames.sql and create_random_addrs.sql to create new tables for logging randomly-allocated email addresses and real names for completions. These shouldn't have any interactions with old database contents.
Then rebuild libpbe and the daemons.
In this version the database has been extended to include the tsearch2 index table used for the Keywords/ actions framework extension. To add this, run part_tsearch.sql to add the table. If you want you can just index new messages - this will happen automatically once you have compiled and installed the new smtpd. If you want to index your existing messages, compile the utility in the partindex directory. When you run this it will index up to 10 existing messages. This rather small limit is because the query to find un-indexed messages is inexplicably slow; I'll fix it when I know how. You can try increasing it by changing the value passed from main() to the do_index() function.
To add the Keywords/ mailbox hierarchy, run actions/keywords.sql and then re-run mailboxes.sql.
In this version, the mailbox queries have been changed so that they don't need to explicitly check for correct ownership of the messages that they select (e.g. using $U in the actions framework); instead they look for the messages in a set of views whose names begin "u_" that narrow the main database tables to the current users' messages.
You need to change your database to reflect this change. I suggest something like this:
In this version the separate to_addrs, cc_addrs and bcc_addrs tables have been replaced by a single table, recipients. You should create this table and populate it from your existing tables, and create its indexes, as follows:
You then need to update the actions framework wherever it uses to_addrs, cc_addrs and bcc_addrs. This means you need to redefine the views lists_mailboxes and people_mailboxes by copying their new definitions from the sql files (use "create or replace view"). You'll also need to update the entries in the actions table for the Lists and Spam mailbox hierarchies using the new definitions.
Then compile and install the new daemons.
When you're happy that it is working you can delete your old to_addrs, cc_addrs and bcc_addrs tables.
No SQL has changed in this version, so you don't need to touch your database at all. Just recompile the daemons.