Fix migrations not using tx (#5282)

This commit is contained in:
WithoutPants
2024-09-22 14:03:54 +10:00
committed by GitHub
parent fd9e4b3ec2
commit 7e8c764dc7
9 changed files with 50 additions and 48 deletions

View File

@@ -88,7 +88,7 @@ func (m *schema34Migrator) migrateObjects(ctx context.Context, table string, col
query += fmt.Sprintf(" ORDER BY `id` LIMIT %d", limit)
rows, err := m.db.Query(query)
rows, err := tx.Query(query)
if err != nil {
return err
}
@@ -126,7 +126,7 @@ func (m *schema34Migrator) migrateObjects(ctx context.Context, table string, col
updateSQL := fmt.Sprintf("UPDATE `%s` SET %s WHERE `id` = ?", table, updateList)
_, err = m.db.Exec(updateSQL, args...)
_, err = tx.Exec(updateSQL, args...)
if err != nil {
return err
}