Software /
code /
prosody
Diff
util/sql.lua @ 5890:544ca3d94596
util.sql: Rewrite MEDIUMTEXT to TEXT for drivers other than MySQL
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 30 Oct 2013 10:24:35 +0100 |
parent | 5889:ea6a3adb6a69 |
child | 5910:a19b3646d5f0 |
line wrap: on
line diff
--- a/util/sql.lua Tue Oct 29 11:43:49 2013 +0100 +++ b/util/sql.lua Wed Oct 30 10:24:35 2013 +0100 @@ -260,7 +260,11 @@ 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