Skip to content

Commit 04b36eb

Browse files
authored
Merge pull request #1070 from certifaction/mysql-safe-update
Make MySQL SetVersion compatible with sql_safe_update
2 parents 45e4f1e + e428ece commit 04b36eb

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)