aboutsummaryrefslogtreecommitdiffstats
path: root/util/sql.lua
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
commit136139f068145195233ed7aeb444d1a9bb45f7d4 (patch)
tree87de86f913945fe82d5539f8be6f5a92d82b3f44 /util/sql.lua
parent6c769838e9a81a145796cb447c03967f5c6fdb7a (diff)
downloadprosody-136139f068145195233ed7aeb444d1a9bb45f7d4.tar.gz
prosody-136139f068145195233ed7aeb444d1a9bb45f7d4.zip
util.sql: Allow columns to be marked the primary key
Diffstat (limited to 'util/sql.lua')
-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.. ");"