Skip to content
Snippets Groups Projects
Commit 74834350 authored by dg's avatar dg
Browse files

hum

git-svn-id: http://svn.net-core.org/repos/t-engine4@980 51575b47-30f0-44d4-a5cc-537603b46e54
parent 55be842b
No related branches found
No related tags found
No related merge requests found
......@@ -68,21 +68,19 @@ end
local function constructTableQuery(name, def)
local fields, keys = {}, {}
for fname, fdef in pairs(def) do
if fname ~= "__options" then
fields[#fields+1] = {position=fdef.position, sql=fname.." "..fdef.type}
if fdef.primary_key then keys[#keys+1] = {position=fdef.position, sql="PRIMARY KEY ("..fname..")"} end
end
fields[#fields+1] = {position=fdef.position, sql=fname.." "..fdef.type}
if fdef.primary_key then keys[#keys+1] = {position=fdef.position, sql="PRIMARY KEY ("..fname..")"} end
end
table.sort(fields, function(a, b) return a.position < b.position end)
table.sort(keys, function(a, b) return a.position < b.position end)
-- Make the statement
local fs = {}
local fs = { "uuid CHAR(36) NOT NULL" }
-- Add fields
for i = 1, #fields do fs[#fs+1] = fields[i].sql end
-- Add keys
for i = 1, #keys do fs[#fs+1] = keys[i].sql end
return "CREATE TABLE "..name.." ("..table.concat(fs, ",")..")"
return "CREATE TABLE "..name.." ("..table.concat(fs, ", ")..")"
end
------------------------------------------------------------
......
......@@ -9,7 +9,7 @@ return {
},
statements =
{
setAllowBuild = [[REPLACE INTO allow_build VALUES (:what, 1)]],
setAllowBuild = [[REPLACE INTO allow_build (what, allowed) VALUES (:what, 1)]],
},
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment