diff options
author | Kim Alvefur <zash@zash.se> | 2013-10-30 10:24:35 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-10-30 10:24:35 +0100 |
commit | f04a2061aaffe9e56905f1daa40970d58c29cebf (patch) | |
tree | 11a67f3fc48db42007456ecfb42bede9139807cd /util | |
parent | 7b0320c5c674ee0eaa45fac9655202cd6a37fbd0 (diff) | |
download | prosody-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.lua | 6 |
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 |