Correct nullability for tests in to_one
- Use the nullability of the fkey column in question to determine nullability for the entire struct to make things easy, otherwise we'd have to pluck out one at a time. This makes the tests pass instead of fail sporadically. - Fix #160
This commit is contained in:
parent
e339812027
commit
ca9f47de8b
1 changed files with 2 additions and 2 deletions
|
@ -13,10 +13,10 @@ func test{{$txt.LocalTable.NameGo}}ToOne{{$txt.ForeignTable.NameGo}}Using{{$txt.
|
||||||
var foreign {{$txt.ForeignTable.NameGo}}
|
var foreign {{$txt.ForeignTable.NameGo}}
|
||||||
|
|
||||||
seed := randomize.NewSeed()
|
seed := randomize.NewSeed()
|
||||||
if err := randomize.Struct(seed, &local, {{$varNameSingular}}DBTypes, true, {{$varNameSingular}}ColumnsWithDefault...); err != nil {
|
if err := randomize.Struct(seed, &local, {{$varNameSingular}}DBTypes, {{if .Nullable}}true{{else}}false{{end}}, {{$varNameSingular}}ColumnsWithDefault...); err != nil {
|
||||||
t.Errorf("Unable to randomize {{$txt.LocalTable.NameGo}} struct: %s", err)
|
t.Errorf("Unable to randomize {{$txt.LocalTable.NameGo}} struct: %s", err)
|
||||||
}
|
}
|
||||||
if err := randomize.Struct(seed, &foreign, {{$foreignVarNameSingular}}DBTypes, true, {{$foreignVarNameSingular}}ColumnsWithDefault...); err != nil {
|
if err := randomize.Struct(seed, &foreign, {{$foreignVarNameSingular}}DBTypes, {{if .ForeignColumnNullable}}true{{else}}false{{end}}, {{$foreignVarNameSingular}}ColumnsWithDefault...); err != nil {
|
||||||
t.Errorf("Unable to randomize {{$txt.ForeignTable.NameGo}} struct: %s", err)
|
t.Errorf("Unable to randomize {{$txt.ForeignTable.NameGo}} struct: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue