mod_storage_sql

SQL database storage backend for Prosody 0.8 and later.

Details

mod_storage_sql allows Prosody to connect to an SQL database to store data. Officially supported databases are SQLite3, MySQL and PostgreSQL.

Usage

Firstly, ensure you have the LuaDBI library available on your system. For information on how, refer to our documentation on dependencies.

Then add the following to your config file:

Table management

If Prosody has the necessary permissions it will automatically initialize the database (creating tables and indexes) when you point it to a new empty database. Any schema upgrades will also be automatic.

In particular it is recommended that you grant Prosody the following SQL permissions on its database: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX.

If you do not wish Prosody to attempt automatic table and schema management, set sql_manage_tables to false in your config.

For information on the database schema, please see our mod_storage_sql developer documentation.

Configuration

Option Default Notes
sql { driver = "SQLite3", database = "prosody.sqlite" } Configure the database to use (see above).
sql_manage_tables true Specifies whether Prosody will automatically create/update the tables it needs (recommended).