Skip to content

Commit e428ece

Browse files
committed
Make MySQL SetVersion compatible with sql_safe_update
1 parent 0c456c4 commit e428ece

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

database/mysql/mysql.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ func (m *Mysql) SetVersion(version int, dirty bool) error {
361361
return &database.Error{OrigErr: err, Err: "transaction start failed"}
362362
}
363363

364-
query := "DELETE FROM `" + m.config.MigrationsTable + "`"
364+
query := "DELETE FROM `" + m.config.MigrationsTable + "` LIMIT 1"
365365
if _, err := tx.ExecContext(context.Background(), query); err != nil {
366366
if errRollback := tx.Rollback(); errRollback != nil {
367367
err = multierror.Append(err, errRollback)

0 commit comments

Comments
 (0)