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

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

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
}