aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-10-28 23:19:47 +0100
committerKim Alvefur <zash@zash.se>2013-10-28 23:19:47 +0100
commit50ec28d155b199d8fd801926e1c5a136c929f7ce (patch)
tree87de86f913945fe82d5539f8be6f5a92d82b3f44
parent9c9c79584776f8c53ab240fb55ae3121d6095b70 (diff)
downloadprosody-50ec28d155b199d8fd801926e1c5a136c929f7ce.tar.gz
prosody-50ec28d155b199d8fd801926e1c5a136c929f7ce.zip
util.sql: Allow columns to be marked the primary key
-rw-r--r--util/sql.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/sql.lua b/util/sql.lua
index 736417bb..7c9743e1 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -262,6 +262,7 @@ function engine:_create_table(table)
for i,col in ipairs(table.c) do
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 i ~= #table.c then sql = sql..", "; end
end
sql = sql.. ");"