aboutsummaryrefslogtreecommitdiffstats
path: root/util/sql.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/sql.lua')
-rw-r--r--util/sql.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/util/sql.lua b/util/sql.lua
index 7c9743e1..cab1bcec 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -263,6 +263,15 @@ function engine:_create_table(table)
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.. ");"