Merge pull request #1070 from certifaction/mysql-safe-update

Make MySQL SetVersion compatible with sql_safe_update
This commit is contained in:
Dale Hui
2024-04-29 21:59:22 -07:00
committed by GitHub
+1 -1
View File
@@ -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)