diff options
author | Kim Alvefur <zash@zash.se> | 2013-10-31 00:53:59 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-10-31 00:53:59 +0100 |
commit | 7769c9bc36dce87f4d4f51dc8578b1aa6c220b08 (patch) | |
tree | 4f96bc22697f670df7fd94b6f6bb97c5d1135e7f /plugins | |
parent | b3f9455c97ef20a674c774daa2490028ee168801 (diff) | |
download | prosody-7769c9bc36dce87f4d4f51dc8578b1aa6c220b08.tar.gz prosody-7769c9bc36dce87f4d4f51dc8578b1aa6c220b08.zip |
mod_storage_sql2: Switch to the util.sql table definition for the main table
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_storage_sql2.lua | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua index 9be10d24..9b365a1e 100644 --- a/plugins/mod_storage_sql2.lua +++ b/plugins/mod_storage_sql2.lua @@ -27,7 +27,7 @@ local engine; -- TODO create engine local function create_table() 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 }; @@ -40,26 +40,6 @@ local function create_table() }; engine:transaction(function() ProsodyTable:create(engine); - end);]] - - local create_sql = "CREATE TABLE `prosody` (`host` TEXT, `user` TEXT, `store` TEXT, `key` TEXT, `type` TEXT, `value` TEXT);"; - if params.driver == "PostgreSQL" then - create_sql = create_sql:gsub("`", "\""); - elseif params.driver == "MySQL" then - create_sql = create_sql:gsub("`value` TEXT", "`value` MEDIUMTEXT") - :gsub(";$", " CHARACTER SET 'utf8' COLLATE 'utf8_bin';"); - end - - local index_sql = "CREATE INDEX `prosody_index` ON `prosody` (`host`, `user`, `store`, `key`)"; - if params.driver == "PostgreSQL" then - index_sql = index_sql:gsub("`", "\""); - elseif params.driver == "MySQL" then - index_sql = index_sql:gsub("`([,)])", "`(20)%1"); - end - - local success,err = engine:transaction(function() - engine:execute(create_sql); - engine:execute(index_sql); end); local ProsodyArchiveTable = Table { |