Skip to content

Commit 7a71858

Browse files
Fix InsertWhitelist test in composite primary key table
- The table has a composite primary key with columns that have default values and columns that don't. - ColumnsWithoutDefault columns don't guarantee unique records.
1 parent ea56d78 commit 7a71858

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/test/insert.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func test{{$alias.UpPlural}}InsertWhitelist(t *testing.T) {
3939
{{if not .NoContext}}ctx := context.Background(){{end}}
4040
tx := MustTx({{if .NoContext}}boil.Begin(){{else}}boil.BeginTx(ctx, nil){{end}})
4141
defer func() { _ = tx.Rollback() }()
42-
if err = o.Insert({{if not .NoContext}}ctx, {{end -}} tx, boil.Whitelist({{$alias.DownSingular}}ColumnsWithoutDefault...)); err != nil {
42+
if err = o.Insert({{if not .NoContext}}ctx, {{end -}} tx, boil.Whitelist(strmangle.SetMerge({{$alias.DownSingular}}PrimaryKeyColumns, {{$alias.DownSingular}}ColumnsWithoutDefault)...)); err != nil {
4343
t.Error(err)
4444
}
4545

0 commit comments

Comments
 (0)