diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dblib.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/dblib.lua b/lib/dblib.lua index b3fc3ac..093a546 100644 --- a/lib/dblib.lua +++ b/lib/dblib.lua @@ -90,6 +90,8 @@ _luadb = { return "BLOB" elseif ttype:upper() == "DATETIME" then return "DATETIME" + elseif ttype:upper() == "TIMESTAMP" then + return "TIMESTAMP" elseif ttype:upper() == "FLOAT" then return "FLOAT" elseif ttype:upper() == "TEXT" then @@ -104,10 +106,12 @@ _luadb = { local r, alters, keys = {}, {}, {} for k, v in pairs(ddl) do + local type r[k] = "" alters[k] = {} - r[k] = _luadb.get_canon_type(v.type, k) + type = _luadb.get_canon_type(v.type, k) + r[k] = type if v.length == nil then -- do nothing @@ -151,6 +155,8 @@ _luadb = { error("Default value for field " .. k .. " isn't usable.") end r[k] = r[k] .. ' DEFAULT "' .. db.sql_escape(v.default) .. '"' + elseif type == "TIMESTAMP" then + r[k] = r[k] .. ' DEFAULT CURRENT_TIMESTAMP' end end return r, alters, keys |