# HG changeset patch # User Kim Alvefur # Date 1373585678 -7200 # Node ID 6fce00f61acf82cda2e818cf76b730fe6c0b9e9a # Parent 2e9ad9cb206fbaad2373055759d459e866901764 mod_storage_sql2: Create an additional table `prosodyarchive` for chronological collections diff -r 2e9ad9cb206f -r 6fce00f61acf plugins/mod_storage_sql2.lua --- a/plugins/mod_storage_sql2.lua Thu Jul 11 22:07:55 2013 +0200 +++ b/plugins/mod_storage_sql2.lua Fri Jul 12 01:34:38 2013 +0200 @@ -23,7 +23,8 @@ local engine; -- TODO create engine local function create_table() - --[[local Table,Column,Index = mod_sql.Table,mod_sql.Column,mod_sql.Index; + local Table,Column,Index = mod_sql.Table,mod_sql.Column,mod_sql.Index; + --[[ local ProsodyTable = Table { name="prosody"; Column { name="host", type="TEXT", nullable=false }; @@ -78,6 +79,22 @@ end end end + local ProsodyArchiveTable = Table { + name="prosodyarchive"; + Column { name="sort_id", type="INTEGER PRIMARY KEY AUTOINCREMENT", nullable=false }; + Column { name="host", type="TEXT", nullable=false }; + Column { name="user", type="TEXT", nullable=false }; + Column { name="store", type="TEXT", nullable=false }; + Column { name="key", type="TEXT", nullable=false }; -- item id + Column { name="when", type="INTEGER", nullable=false }; -- timestamp + Column { name="with", type="TEXT", nullable=false }; -- related id + Column { name="type", type="TEXT", nullable=false }; + Column { name="value", type=params.driver == "MySQL" and "MEDIUMTEXT" or "TEXT", nullable=false }; + Index { name="prosodyarchive_index", "host", "user", "store", "key" }; + }; + engine:transaction(function() + ProsodyArchiveTable:create(engine); + end); end local function set_encoding() if params.driver ~= "SQLite3" then