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 | 9e2d18bd9872efa7abc9dec3e4c3af83d109243d (patch) | |
tree | 4f96bc22697f670df7fd94b6f6bb97c5d1135e7f | |
parent | cc7547d712dc3ee7519313c92b5f877b89d64d95 (diff) | |
download | prosody-9e2d18bd9872efa7abc9dec3e4c3af83d109243d.tar.gz prosody-9e2d18bd9872efa7abc9dec3e4c3af83d109243d.zip |
mod_storage_sql2: Switch to the util.sql table definition for the main table
-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 { |