3. Database

3.1. Database creation

The creation and initialization of a database to the point when it's ready to store messages is normally done using the manitou-mgr command, although it can also be done manually with the SQL scripts from the source code archive.

To create the database from scratch, manitou-mgr has to connect as a database superuser. Assuming that the PostgreSQL server has the default security configuration (see pg_hba.conf file), running manitou-mgr as shown below from the local postgres Unix account on the server is the simplest option.

postgres:~$ manitou-mgr --create-database
Database user manitou created.
Database manitou created.
Creating tables
Creating sequences
Creating functions
Creating triggers
Database manitou successfully created.

Non default behavior can be achieved using options --db-name, --db-user, --db-super-user, --db-super-password, --db-host, --db--port to the --create-database command. The command manitou-mgr --help gives usage information.

Once the database is created, the db_connect_string entry in the manitou-mdx configuration file must be set up to point to the database, with optionally the user, password, host, port and other information needed to connect.

3.2. Database schema upgrade

When upgrading to a new version of Manitou-Mail, a database schema upgrade should be performed after having stopped of the old version of manitou-mdx and before having started the new version:

postgres:~$ manitou-mgr --upgrade-schema
Upgrading from 0.9.12 to 1.0.0
Schema upgrade successful