mod_mam_sql/README.wiki
changeset 1786 29f3d6b7ad16
child 1801 a946aa422503
equal deleted inserted replaced
1785:12ac88940fe3 1786:29f3d6b7ad16
       
     1 #summary XEP-0313: Message Archive Management using SQL
       
     2 #labels Stage-Alpha, Deprecated
       
     3 
       
     4 *Note:* This module is unsupported and not up to date with the MAM specification
       
     5 
       
     6 = Introduction =
       
     7 
       
     8 Implementation of (an older version of) [http://xmpp.org/extensions/xep-0313.html XEP-0313: Message Archive Management] backed by a SQL database.  Like [mod_mam], but using SQL.
       
     9 
       
    10 
       
    11 = Details =
       
    12 
       
    13 See [mod_mam] for details.
       
    14 
       
    15 = Usage =
       
    16 
       
    17 First copy the module to the prosody plugins directory.
       
    18 
       
    19 Then add "mam_sql" to your modules_enabled list:
       
    20 {{{
       
    21     modules_enabled = {
       
    22                     -- ...
       
    23                     "mam_sql",
       
    24                     -- ...
       
    25 		}
       
    26 }}}
       
    27 
       
    28 You should probably run the SQL to create the archive table/indexes:
       
    29 
       
    30 {{{
       
    31 CREATE TABLE `prosodyarchive` (
       
    32         `host` TEXT,
       
    33         `user` TEXT,
       
    34         `store` TEXT,
       
    35         `id` INTEGER PRIMARY KEY AUTOINCREMENT,
       
    36         `when` INTEGER,
       
    37         `with` TEXT,
       
    38         `resource` TEXT,
       
    39         `stanza` TEXT
       
    40 );
       
    41 CREATE INDEX `hus` ON `prosodyarchive` (`host`, `user`, `store`);
       
    42 CREATE INDEX `with` ON `prosodyarchive` (`with`);
       
    43 CREATE INDEX `thetime` ON `prosodyarchive` (`when`);
       
    44 }}}
       
    45 
       
    46 (*NOTE*: I ran the following SQL to initialize the table/indexes on MySQL):
       
    47 
       
    48 {{{
       
    49 CREATE TABLE prosodyarchive (
       
    50   `host`     VARCHAR(1023) NOT NULL,
       
    51   `user`     VARCHAR(1023) NOT NULL,
       
    52   `store`    VARCHAR(1023) NOT NULL,
       
    53   `id`       INTEGER PRIMARY KEY AUTO_INCREMENT,
       
    54   `when`     INTEGER     NOT NULL,
       
    55   `with`     VARCHAR(2047) NOT NULL,
       
    56   `resource` VARCHAR(1023),
       
    57   `stanza`   TEXT        NOT NULL
       
    58 );
       
    59 CREATE INDEX hus ON prosodyarchive (host, user, store);
       
    60 CREATE INDEX `with` ON prosodyarchive (`with`);
       
    61 CREATE INDEX thetime ON prosodyarchive (`when`);
       
    62 }}}
       
    63 
       
    64 You may want to tweak the column sizes a bit; I did for my own purposes.
       
    65 
       
    66 = Configuration =
       
    67 
       
    68 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.
       
    69 
       
    70 = Compatibility =
       
    71 || 0.8 || ? ||
       
    72 || 0.9 || Works ||
       
    73 || trunk || Works ||