aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-10-30 10:24:35 +0100
committerKim Alvefur <zash@zash.se>2013-10-30 10:24:35 +0100
commitf04a2061aaffe9e56905f1daa40970d58c29cebf (patch)
tree11a67f3fc48db42007456ecfb42bede9139807cd /util
parent7b0320c5c674ee0eaa45fac9655202cd6a37fbd0 (diff)
downloadprosody-f04a2061aaffe9e56905f1daa40970d58c29cebf.tar.gz
prosody-f04a2061aaffe9e56905f1daa40970d58c29cebf.zip
util.sql: Rewrite MEDIUMTEXT to TEXT for drivers other than MySQL
Diffstat (limited to 'util')
-rw-r--r--util/sql.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/sql.lua b/util/sql.lua
index 8c870b64..735fbce8 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -260,7 +260,11 @@ end
function engine:_create_table(table)
local sql = "CREATE TABLE `"..table.name.."` (";
for i,col in ipairs(table.c) do
- sql = sql.."`"..col.name.."` "..col.type;
+ local col_type = col.type;
+ if col_type == "MEDIUMTEXT" and self.params.driver ~= "MySQL" then
+ col_type = "TEXT"; -- MEDIUMTEXT is MySQL-specific
+ end
+ sql = sql.."`"..col.name.."` "..col_type;
if col.nullable == false then sql = sql.." NOT NULL"; end
if col.primary_key == true then sql = sql.." PRIMARY KEY"; end
if col.auto_increment == true then