Skip to content

Commit 90ad8f8

Browse files
committed
fix(test): add WHERE clause for large batch update test
GoFrame requires WHERE clause for UPDATE operations as a safety measure. Changed from bare Update() to Where("id > ?", 0).Update() to update all records while satisfying the safety check. ref gogf#4689
1 parent e05d170 commit 90ad8f8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

contrib/drivers/mysql/mysql_z_unit_transaction_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,9 +2579,9 @@ func Test_Transaction_Large_Batch_Update(t *testing.T) {
25792579
_, err := db.Insert(ctx, table, data)
25802580
t.AssertNil(err)
25812581

2582-
// Update all records in transaction
2582+
// Update all records in transaction (WHERE required for safety)
25832583
err = db.Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
2584-
_, err := tx.Model(table).Update(g.Map{"nickname": "updated"})
2584+
_, err := tx.Model(table).Where("id > ?", 0).Update(g.Map{"nickname": "updated"})
25852585
return err
25862586
})
25872587
t.AssertNil(err)

0 commit comments

Comments
 (0)