Software /
code /
prosody
Changeset
5894:9e47ece9457c
mod_storage_sql2: Switch to the util.sql table definition for the main table
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 31 Oct 2013 00:53:59 +0100 |
parents | 5893:62ce0328fdfe |
children | 5896:019130907a07 |
files | plugins/mod_storage_sql2.lua |
diffstat | 1 files changed, 1 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_sql2.lua Wed Oct 30 22:37:07 2013 +0100 +++ b/plugins/mod_storage_sql2.lua Thu Oct 31 00:53:59 2013 +0100 @@ -27,7 +27,7 @@ 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 @@ }; 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 {