replace TRUNCATE with DELETE FROM to avoid schema changes within transaction

This commit is contained in:
Jason Hutchinson 2017-11-02 16:59:26 -05:00
parent 69472d5f5c
commit c156f5f3a1

View File

@ -223,7 +223,7 @@ func (c *CockroachDb) Run(migration io.Reader) error {
func (c *CockroachDb) SetVersion(version int, dirty bool) error {
return crdb.ExecuteTx(context.Background(), c.db, nil, func(tx *sql.Tx) error {
if _, err := tx.Exec( `TRUNCATE "` + c.config.MigrationsTable + `"`); err != nil {
if _, err := tx.Exec(`DELETE FROM "` + c.config.MigrationsTable + `"`); err != nil {
return err
}