Changeset

5886:1237f9cc3123

util.sql: Allow columns to be marked the primary key
author Kim Alvefur <zash@zash.se>
date Mon, 28 Oct 2013 23:19:47 +0100
parents 5885:cbc25ae1eea0
children 5887:1f860279b2f8
files util/sql.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/sql.lua	Mon Oct 28 23:18:54 2013 +0100
+++ b/util/sql.lua	Mon Oct 28 23:19:47 2013 +0100
@@ -262,6 +262,7 @@
 	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.. ");"