# HG changeset patch # User rdhoelz@gmail.com # Date 1366883458 0 # Node ID 6cc2d1e280c9347156103bd61a4c591765244888 # Parent 8e758f27b46075a3a8548655f1033731528dfcfe Created wiki page through web user interface. diff -r 8e758f27b460 -r 6cc2d1e280c9 mod_mam_sql.wiki --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_mam_sql.wiki Thu Apr 25 09:50:58 2013 +0000 @@ -0,0 +1,70 @@ +#summary XEP-0313: Message Archive Management using SQL + += Introduction = + +Implementation of [http://xmpp.org/extensions/xep-0313.html XEP-0313: Message Archive Management] backed by a SQL database. Like [mod_mam], but using SQL. + + += Details = + +See [mod_mam] for details. + += Usage = + +First copy the module to the prosody plugins directory. + +Then add "mam_sql" to your modules_enabled list: +{{{ + modules_enabled = { + -- ... + "mam_sql", + -- ... + } +}}} + +You should probably run the SQL to create the archive table/indexes: + +{{{ +CREATE TABLE `prosodyarchive` ( + `host` TEXT, + `user` TEXT, + `store` TEXT, + `id` INTEGER PRIMARY KEY AUTOINCREMENT, + `when` INTEGER, + `with` TEXT, + `resource` TEXT, + `stanza` TEXT +); +CREATE INDEX `hus` ON `prosodyarchive` (`host`, `user`, `store`); +CREATE INDEX `with` ON `prosodyarchive` (`with`); +CREATE INDEX `thetime` ON `prosodyarchive` (`when`); +}}} + +(*NOTE*: I ran the following SQL to initialize the table/indexes on MySQL): + +{{{ +CREATE TABLE prosodyarchive ( + `host` VARCHAR(16) NOT NULL, + `user` VARCHAR(16) NOT NULL, + `store` CHAR(8) NOT NULL, + `id` INTEGER PRIMARY KEY AUTO_INCREMENT, + `when` INTEGER NOT NULL, + `with` VARCHAR(32) NOT NULL, + `resource` VARCHAR(16) NOT NULL, + `stanza` TEXT NOT NULL +); +CREATE INDEX hus ON prosodyarchive (host, user, store); +CREATE INDEX `with` ON prosodyarchive (`with`); +CREATE INDEX thetime ON prosodyarchive (`when`); +}}} + +You may want to tweak the column sizes a bit; I did for my own purposes. + += Configuration = + +This module uses the same configuration settings that [mod_mam] does, in addition to the [http://prosody.im/doc/modules/mod_storage_sql SQL storage settings]. You may also name the SQL connection settings 'mam_sql' if you want. + += Compatibility = +|| 0.8 || ? || +|| 0.9 || Works || +|| trunk || Works || \ No newline at end of file