# HG changeset patch # User Kim Alvefur # Date 1383177239 -3600 # Node ID 9e47ece9457c8274c7ea82b13ec9bee9b54d38fb # Parent 62ce0328fdfec90e8763b814c7a2e76c04c52cce mod_storage_sql2: Switch to the util.sql table definition for the main table diff -r 62ce0328fdfe -r 9e47ece9457c plugins/mod_storage_sql2.lua --- 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 {