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 | 1bcfdab54f7785d3db05c65ad5672406885d0b91 (patch) | |
tree | 11a67f3fc48db42007456ecfb42bede9139807cd /util | |
parent | 29988cfa70e9f0c0e8be63d3f6334a36fbe55ec3 (diff) | |
download | prosody-1bcfdab54f7785d3db05c65ad5672406885d0b91.tar.gz prosody-1bcfdab54f7785d3db05c65ad5672406885d0b91.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 |