Closed eleztian closed 2 months ago
https://github.com/go-gorm/playground/pull/1
If there is a unique index in the generated unit test, an error will be reported.
func Test_tblUserQuery(t *testing.T) { ..... err = _do.CreateInBatches([]*model.TblUser{{}, {}}, 10) if err != nil { t.Error("create item in table <tbl_user> fail:", err) } }
tbl_user.gen_test.go:57: create item in table <tbl_user> fail: UNIQUE constraint failed: tbl_user.ns, tbl_user.identity_id, tbl_user.name
same problem
The generated unit test is just a template and can be modified by yourself. Just don't generate a unit test next time it is generated.
GORM Playground Link
https://github.com/go-gorm/playground/pull/1
Description
If there is a unique index in the generated unit test, an error will be reported.