truncate table at begin

master
Oliver Tonnhofer 2013-06-11 14:43:14 +02:00
parent a415956ca7
commit ef77711c60
1 changed files with 4 additions and 0 deletions

View File

@ -410,6 +410,10 @@ func (tt *TableTx) Begin() error {
return err
}
tt.Tx = tx
_, err = tx.Exec(fmt.Sprintf(`TRUNCATE TABLE "%s"."%s" RESTART IDENTITY`, tt.Pg.Schema, tt.Table))
if err != nil {
return err
}
tt.Sql = tt.Spec.InsertSQL()
stmt, err := tt.Tx.Prepare(tt.Sql)
if err != nil {