util/sql.lua
changeset 5887 1f860279b2f8
parent 5886 1237f9cc3123
child 5888 f3e408ae59a6
--- a/util/sql.lua	Mon Oct 28 23:19:47 2013 +0100
+++ b/util/sql.lua	Mon Oct 28 23:20:25 2013 +0100
@@ -263,6 +263,15 @@
 		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 col.auto_increment == true then
+			if self.params.driver == "PostgreSQL" then
+				sql = sql.." SERIAL";
+			elseif self.params.driver == "MySQL" then
+				sql = sql.." AUTO_INCREMENT";
+			elseif self.params.driver == "SQLite3" then
+				sql = sql.." AUTOINCREMENT";
+			end
+		end
 		if i ~= #table.c then sql = sql..", "; end
 	end
 	sql = sql.. ");"