Skip to content

Commit

Permalink
Make MySQL SetVersion compatible with sql_safe_update
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmati committed Apr 10, 2024
1 parent 87ba13c commit 869888f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion database/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func (m *Mysql) SetVersion(version int, dirty bool) error {
return &database.Error{OrigErr: err, Err: "transaction start failed"}
}

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

0 comments on commit 869888f

Please sign in to comment.