aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_sql2.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-07-12 01:34:38 +0200
committerKim Alvefur <zash@zash.se>2013-07-12 01:34:38 +0200
commit8a80110435df4e5f99956486ea3fb85df337f462 (patch)
tree78894bc271635ceb93ad3be93cb7248fbd9bb964 /plugins/mod_storage_sql2.lua
parent06e7d7b489229a80e144ad883a2addde6d92c730 (diff)
downloadprosody-8a80110435df4e5f99956486ea3fb85df337f462.tar.gz
prosody-8a80110435df4e5f99956486ea3fb85df337f462.zip
mod_storage_sql2: Create an additional table `prosodyarchive` for chronological collections
Diffstat (limited to 'plugins/mod_storage_sql2.lua')
-rw-r--r--plugins/mod_storage_sql2.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua
index 8081c0f9..4f6f7f04 100644
--- a/plugins/mod_storage_sql2.lua
+++ b/plugins/mod_storage_sql2.lua
@@ -23,7 +23,8 @@ local params = module:get_option("sql");
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 @@ local function create_table()
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