update xorm vendor and also fix #740 (#886)

This commit is contained in:
Lunny Xiao authored and GitHub committed 2017-02-10 23:02:26 +08:00
1 parent 2f13d31ff0
commit 284c0160c3
3 files changed
+20 -16

No files matched your search

+8
View File
@@ -521,6 +521,14 @@ func (engine *Engine) dumpTables(tables []*core.Table, w io.Writer, tp ...core.D
return err
}
}
// FIXME: Hack for postgres
if string(dialect.DBType()) == core.POSTGRES && table.AutoIncrColumn() != nil {
_, err = io.WriteString(w, "SELECT setval('table_id_seq', COALESCE((SELECT MAX("+table.AutoIncrColumn().Name+") FROM "+dialect.Quote(table.Name)+"), 1), false);\n")
if err != nil {
return err
}
}
}
return nil
}