Manitou-Mail Home

3. Database

3.1. Database creation

The creation and initialization of the database are carried out with the manitou-mgr command.

In order to have the permission to create the database, manitou-mgr has to connect as a database superuser, which under the default PostgreSQL configuration is postgres, which generally exists as a database account and as an operating system account. The simplest way to create the database is to issue the following command when logged in as the postgres account:

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

On certain systems, sudo is the preferred method to run commands that need certain privileges from a non-privileged account. In this case, the database creation could be invoked as follows:

myaccount:$~ sudo -u 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 values for the database connection and authentication parameters can be introduced using these options to the --create-database command: --db-name, --db-user, --db-super-user, --db-super-password, --db-host, --db--port . 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 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