summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2008-10-06 11:30:31 -0700
committerPixel <pixel@nobis-crew.org>2008-10-06 11:30:31 -0700
commit08c24ff362b18132ce2162e8879965327cc5bfce (patch)
treebb07653ab52ac86a715ab3df93343a8ed2b22416
parent52032e9ffeaf7ec28f87220dcd3b76146b0c02a9 (diff)
Adding 'timestamp' type.
-rw-r--r--lib/dblib.lua8
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