gen icon indicating copy to clipboard operation
gen copied to clipboard

If there is a unique index in the generated unit test, an error will be reported.

Open eleztian opened this issue 9 months ago • 2 comments

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.

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

eleztian avatar May 08 '24 05:05 eleztian