Skip to content

Commit

Permalink
Merge pull request #1070 from certifaction/mysql-safe-update
Browse files Browse the repository at this point in the history
Make MySQL SetVersion compatible with sql_safe_update
  • Loading branch information
dhui committed Apr 30, 2024
2 parents 45e4f1e + e428ece commit 04b36eb
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 04b36eb

Please sign in to comment.