From 891e280a45de23f403cae821597dc64f6208325c Mon Sep 17 00:00:00 2001 From: steebchen Date: Wed, 8 Nov 2023 16:12:39 +0700 Subject: [PATCH 1/2] feat(mongodb): add support for object types --- generator/ast/dmmf/dmmf.go | 15 +++- generator/templates/models.gotpl | 13 ++- generator/templates/types.gotpl | 18 ++++ .../databases/mongodb/objects/default_test.go | 85 +++++++++++++++++++ test/databases/mongodb/objects/schema.prisma | 33 +++++++ 5 files changed, 155 insertions(+), 9 deletions(-) create mode 100644 generator/templates/types.gotpl create mode 100644 test/databases/mongodb/objects/default_test.go create mode 100644 test/databases/mongodb/objects/schema.prisma diff --git a/generator/ast/dmmf/dmmf.go b/generator/ast/dmmf/dmmf.go index a1b0d940..2a2421b6 100644 --- a/generator/ast/dmmf/dmmf.go +++ b/generator/ast/dmmf/dmmf.go @@ -211,8 +211,19 @@ type EnumValue struct { // Datamodel contains all types of the Prisma Datamodel. type Datamodel struct { - Models []Model `json:"models"` - Enums []Enum `json:"enums"` + Models []Model `json:"models"` + Types []ObjectType `json:"types"` + Enums []Enum `json:"enums"` +} + +// ObjectType is a MongoDB object type +type ObjectType struct { + Name types.String `json:"name"` + DbName types.String `json:"dbName"` + Fields []Field `json:"fields"` + PrimaryKey string `json:"primaryKey"` + UniqueFields []string `json:"uniqueFields"` + UniqueIndexes []string `json:"uniqueIndexes"` } type UniqueIndex struct { diff --git a/generator/templates/models.gotpl b/generator/templates/models.gotpl index 573dec15..4c2631b5 100644 --- a/generator/templates/models.gotpl +++ b/generator/templates/models.gotpl @@ -10,13 +10,12 @@ // Inner{{ $model.Name.GoCase }} holds the actual data type Inner{{ $model.Name.GoCase }} struct { {{ range $field := $model.Fields }} - {{- if not $field.Kind.IsRelation -}} - {{- if $field.IsRequired }} - {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ end }}{{ $field.Type.Value }} {{ $field.Name.Tag $field.IsRequired }} - {{- else }} - {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ else }}*{{ end }}{{ $field.Type.Value }} {{ $field.Name.Tag $field.IsRequired }} - {{- end }} - {{- end -}} + {{- if eq $field.RelationName "" -}} + {{ $field.Name.GoCase -}} + {{- if $field.IsList }}[]{{ else }}{{- if not $field.IsRequired }}*{{ end }} {{ end -}} + {{ $field.Type.Value }}{{ if eq $field.Kind "object" }}Type{{ end -}} + {{ $field.Name.Tag $field.IsRequired }} + {{- end }} {{ end }} } diff --git a/generator/templates/types.gotpl b/generator/templates/types.gotpl new file mode 100644 index 00000000..2976dcdc --- /dev/null +++ b/generator/templates/types.gotpl @@ -0,0 +1,18 @@ +{{- /*gotype:github.com/steebchen/prisma-client-go/generator.Root*/ -}} + +{{/* Types are for MongoDB object types */}} + +{{ range $type := $.DMMF.Datamodel.Types }} + // {{ $type.Name.GoCase }}Type + type {{ $type.Name.GoCase }}Type struct { + {{ range $field := $type.Fields }} + {{- if not $field.Kind.IsRelation -}} + {{- if $field.IsRequired }} + {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ end }}{{ $field.Type.Value }} {{ $field.Name.Tag $field.IsRequired }} + {{- else }} + {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ else }}*{{ end }}{{ $field.Type.Value }} {{ $field.Name.Tag $field.IsRequired }} + {{- end }} + {{- end -}} + {{ end }} + } +{{ end }} diff --git a/test/databases/mongodb/objects/default_test.go b/test/databases/mongodb/objects/default_test.go new file mode 100644 index 00000000..a62ccd2f --- /dev/null +++ b/test/databases/mongodb/objects/default_test.go @@ -0,0 +1,85 @@ +package raw + +import ( + "context" + "testing" + + "github.com/steebchen/prisma-client-go/test" + "github.com/steebchen/prisma-client-go/test/helpers/massert" +) + +type cx = context.Context +type Func func(t *testing.T, client *PrismaClient, ctx cx) + +func TestObjects(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + before []string + run Func + }{{ + name: "types", + // language=GraphQL + before: []string{` + mutation { + result: createOneUser(data: { + id: "id1", + email: "email1", + info: { + age: 0, + }, + infoOpt: { + age: 0, + }, + list: { + create: [ + { + age: 0, + }, + ] + } + }) { + id + } + } + `}, + run: func(t *testing.T, client *PrismaClient, ctx cx) { + user, err := client.User.FindUnique( + User.ID.Equals("id1"), + ).Exec(ctx) + if err != nil { + t.Fatal(err) + } + + massert.Equal(t, &UserModel{ + InnerUser: InnerUser{ + ID: "id1", + Email: "email1", + Info: InfoType{ + Age: 0, + }, + InfoOpt: &InfoType{ + Age: 0, + }, + List: []InfoType{ + { + Age: 0, + }, + }, + }, + }, user) + }, + }} + for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T) { + client := NewClient() + + mockDB := test.Start(t, test.MongoDB, client.Engine, tt.before) + defer test.End(t, test.MongoDB, client.Engine, mockDB) + + tt.run(t, client, context.Background()) + }) + } +} diff --git a/test/databases/mongodb/objects/schema.prisma b/test/databases/mongodb/objects/schema.prisma new file mode 100644 index 00000000..8c37b599 --- /dev/null +++ b/test/databases/mongodb/objects/schema.prisma @@ -0,0 +1,33 @@ +datasource db { + provider = "mongodb" + url = env("__REPLACE__") +} + +generator db { + provider = "go run github.com/steebchen/prisma-client-go" + output = "." + disableGoBinaries = true + package = "raw" +} + +model User { + id String @id @default(cuid()) @map("_id") + email String @unique + username String + info Info + infoOpt Info? + list Info[] + posts Post[] +} + +type Info { + age Int +} + +// unused relation to check for conflicts etc. +model Post { + id String @id @default(cuid()) @map("_id") + title String + author User @relation(fields: [user_id], references: [id]) + user_id String +} From 40e168a33126893373aeba1b47f8e1d9e9983584 Mon Sep 17 00:00:00 2001 From: steebchen Date: Fri, 10 Nov 2023 18:26:16 +0700 Subject: [PATCH 2/2] wip --- engine/transform.go | 1 + generator/ast/dmmf/dmmf.go | 24 ++++-- generator/templates/actions/actions.gotpl | 2 +- generator/templates/models.gotpl | 26 +++--- generator/templates/query.gotpl | 32 ++++---- generator/templates/types.gotpl | 2 +- .../databases/mongodb/objects/default_test.go | 81 ++++++++++--------- test/databases/mongodb/objects/schema.prisma | 3 +- 8 files changed, 93 insertions(+), 78 deletions(-) diff --git a/engine/transform.go b/engine/transform.go index 576ded82..c3d0e7d0 100644 --- a/engine/transform.go +++ b/engine/transform.go @@ -14,6 +14,7 @@ import ( // -> // ["asdf", null] func transformResponse(data []byte) ([]byte, error) { + logger.Debug.Printf("before transform: %s", data) var m interface{} if err := json.Unmarshal(data, &m); err != nil { return nil, err diff --git a/generator/ast/dmmf/dmmf.go b/generator/ast/dmmf/dmmf.go index 2a2421b6..bdec5f50 100644 --- a/generator/ast/dmmf/dmmf.go +++ b/generator/ast/dmmf/dmmf.go @@ -14,13 +14,8 @@ const ( FieldKindEnum FieldKind = "enum" ) -// IncludeInStruct shows whether to include a field in a model struct. -func (v FieldKind) IncludeInStruct() bool { - return v == FieldKindScalar || v == FieldKindEnum -} - -// IsRelation returns whether field is a relation -func (v FieldKind) IsRelation() bool { +// IsObject returns whether field is an object +func (v FieldKind) IsObject() bool { return v == FieldKindObject } @@ -265,7 +260,7 @@ func (m Model) Actions() []string { func (m Model) RelationFieldsPlusOne() []Field { var fields []Field for _, field := range m.Fields { - if field.Kind.IsRelation() { + if field.IsRelation() { fields = append(fields, field) } } @@ -297,6 +292,19 @@ type Field struct { HasDefaultValue bool `json:"hasDefaultValue"` } +// IncludeInStruct shows whether to include a field in a model struct. +func (f Field) IncludeInStruct() bool { + return f.Kind == FieldKindScalar || f.Kind == FieldKindEnum || f.IsObjectType() +} + +func (f Field) IsRelation() bool { + return f.RelationName != "" +} + +func (f Field) IsObjectType() bool { + return f.Type != "" && !f.IsRelation() && f.Kind == FieldKindObject +} + func (f Field) RequiredOnCreate(key PrimaryKey) bool { if !f.IsRequired || f.IsUpdatedAt || f.HasDefaultValue || f.IsReadOnly || f.IsList { return false diff --git a/generator/templates/actions/actions.gotpl b/generator/templates/actions/actions.gotpl index 70f5b9d5..55a27b6f 100644 --- a/generator/templates/actions/actions.gotpl +++ b/generator/templates/actions/actions.gotpl @@ -15,7 +15,7 @@ var countOutput = []builder.Output{ var {{ $name }}Output = []builder.Output{ {{- range $i := $model.Fields }} - {{- if $i.Kind.IncludeInStruct }} + {{- if $i.IncludeInStruct }} {Name: "{{ $i.Name }}"}, {{- end }} {{- end }} diff --git a/generator/templates/models.gotpl b/generator/templates/models.gotpl index 4c2631b5..50b5b6ce 100644 --- a/generator/templates/models.gotpl +++ b/generator/templates/models.gotpl @@ -22,11 +22,11 @@ // Raw{{ $model.Name.GoCase }}Model is a struct for {{ $model.Name }} when used in raw queries type Raw{{ $model.Name.GoCase }}Model struct { {{ range $field := $model.Fields }} - {{- if not $field.Kind.IsRelation -}} + {{- if not $field.IsRelation -}} {{- if $field.IsRequired }} - {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ end }}Raw{{ $field.Type.GoCase }} {{ $field.Name.Tag $field.IsRequired }} + {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ end }}{{ if not $field.IsObjectType }}Raw{{ end }}{{ $field.Type.GoCase }}{{ if $field.IsObjectType }}Type{{ end }} {{ $field.Name.Tag $field.IsRequired }} {{- else }} - {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ else }}*{{ end }}Raw{{ $field.Type.GoCase }} {{ $field.Name.Tag $field.IsRequired }} + {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ else }}*{{ end }}{{ if not $field.IsObjectType }}Raw{{ end }}{{ $field.Type.GoCase }}{{ if $field.IsObjectType }}Type{{ end }} {{ $field.Name.Tag $field.IsRequired }} {{- end }} {{- end -}} {{ end }} @@ -35,7 +35,7 @@ // Relations{{ $model.Name.GoCase }} holds the relation data separately type Relations{{ $model.Name.GoCase }} struct { {{ range $field := $model.Fields }} - {{- if $field.Kind.IsRelation }} + {{- if $field.IsRelation }} {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ else }}*{{ end }}{{ $field.Type.Value }}Model {{ $field.Name.Tag false }} {{- end -}} {{ end }} @@ -43,27 +43,27 @@ {{/* Attach methods for nullable (non-required) fields and relations. */}} {{- range $field := $model.Fields }} - {{- if or (not $field.IsRequired) ($field.Kind.IsRelation) }} + {{- if or (not $field.IsRequired) ($field.IsRelation) }} func (r {{ $model.Name.GoCase }}Model) {{ $field.Name.GoCase }}() ( - {{- if $field.IsList }}value []{{ else }}value{{ end }} {{ if and $field.Kind.IsRelation (not $field.IsList) }}*{{ end }}{{ $field.Type.Value }}{{ if $field.Kind.IsRelation }}Model{{ end -}} - {{- if or (not $field.Kind.IsRelation) (and (not $field.IsList) (not $field.IsRequired)) -}} + {{- if $field.IsList }}value []{{ else }}value{{ end }} {{ if and $field.IsRelation (not $field.IsList) }}*{{ end }}{{ $field.Type.Value }}{{ if $field.IsRelation }}Model{{ end -}}{{ if $field.IsObjectType }}Type{{ end -}} + {{- if or (not $field.IsRelation) (and (not $field.IsList) (not $field.IsRequired)) -}} , ok bool {{- end -}} ) { - if r.{{ if $field.Kind.IsRelation }}Relations{{ else }}Inner{{ end }}{{ $model.Name.GoCase }}.{{ $field.Name.GoCase }} == nil { - {{- if and ($field.Kind.IsRelation) ($field.IsRequired) }} + if r.{{ if $field.IsRelation }}Relations{{ else }}Inner{{ end }}{{ $model.Name.GoCase }}.{{ $field.Name.GoCase }} == nil { + {{- if and ($field.IsRelation) ($field.IsRequired) }} panic("attempted to access {{ $field.Name.GoLowerCase }} but did not fetch it using the .With() syntax") {{- else }} return value - {{- if or (not $field.Kind.IsRelation) (and (not $field.IsList) (not $field.IsRequired)) -}} + {{- if or (not $field.IsRelation) (and (not $field.IsList) (not $field.IsRequired)) -}} , false {{- end -}} {{- end }} } - return {{ if and (not $field.Kind.IsRelation) (not $field.IsList) }}*{{ end }}r. - {{- if $field.Kind.IsRelation }}Relations{{ else }}Inner{{ end }}{{ $model.Name.GoCase }}. + return {{ if and (not $field.IsRelation) (not $field.IsList) }}*{{ end }}r. + {{- if $field.IsRelation }}Relations{{ else }}Inner{{ end }}{{ $model.Name.GoCase }}. {{- $field.Name.GoCase -}} - {{- if or (not $field.Kind.IsRelation) (and (not $field.IsList) (not $field.IsRequired)) -}} + {{- if or (not $field.IsRelation) (and (not $field.IsList) (not $field.IsRequired)) -}} , true {{- end -}} } diff --git a/generator/templates/query.gotpl b/generator/templates/query.gotpl index 0ad1e5bb..74b3aed5 100644 --- a/generator/templates/query.gotpl +++ b/generator/templates/query.gotpl @@ -17,7 +17,7 @@ {{ if $field.Prisma }} {{ $name = $field.Name.PrismaGoCase }} {{ end }} - {{- if $field.Kind.IncludeInStruct -}} + {{- if $field.IncludeInStruct -}} // {{ $name }} // // @{{ if $field.IsRequired }}required{{ else }}optional{{ end }} @@ -27,7 +27,7 @@ {{ $name }} {{ $nsQuery }}{{ $field.Name.GoCase }}{{ $field.Type }} {{ end }} - {{- if $field.Kind.IsRelation }} + {{- if $field.IsRelation }} {{ $name }} {{ $nsQuery }}{{ $name }}Relations {{ end }} {{- end }} @@ -87,7 +87,7 @@ {{ $setReturnStruct = (print $name "SetParam") }} {{ end}} - {{ if $field.Kind.IsRelation }} + {{ if $field.Field.IsRelation }} type {{ $nsQuery }}{{ $field.Name.GoCase }}Relations struct {} {{ range $method := $field.RelationMethods }} @@ -232,13 +232,13 @@ {{ end }} {{ end }} - {{ if $field.Kind.IncludeInStruct }} + {{ if $field.IncludeInStruct }} {{ if not $field.Prisma }} // Set the {{ if $field.IsRequired }}required{{ else }}optional{{ end }} value of {{ $field.Name.GoCase }} - func (r {{ $struct }}) Set(value {{ if $field.IsList }}[]{{ end }}{{ $field.Type.Value }}) {{ $setReturnStruct }} { + func (r {{ $struct }}) Set(value {{ if $field.IsList }}[]{{ end }}{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}) {{ $setReturnStruct }} { {{ if $field.IsList }} if value == nil { - value = []{{ $field.Type.Value }}{} + value = []{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}{} } {{ end }} {{/* if scalar list (only postgres) */}} @@ -265,7 +265,7 @@ } // Set the optional value of {{ $field.Name.GoCase }} dynamically - func (r {{ $struct }}) SetIfPresent(value *{{ if $field.IsList }}[]{{ else }}{{ end }}{{ $field.Type.Value }}) {{ $setReturnStruct }} { + func (r {{ $struct }}) SetIfPresent(value *{{ if $field.IsList }}[]{{ else }}{{ end }}{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}) {{ $setReturnStruct }} { if value == nil { return {{ $setReturnStruct }}{} } @@ -276,10 +276,10 @@ {{ if and (not $field.IsRequired) (not $field.IsList) (not $field.Prisma) }} // Set the optional value of {{ $field.Name.GoCase }} dynamically - func (r {{ $struct }}) SetOptional(value *{{ $field.Type.Value }}) {{ $setReturnStruct }} { + func (r {{ $struct }}) SetOptional(value *{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}) {{ $setReturnStruct }} { if value == nil { {{/* nil value of type */}} - var v *{{ $field.Type.Value }} + var v *{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }} return {{ $setReturnStruct }}{ data: builder.Field{ Name: "{{ $field.Name }}", @@ -300,7 +300,7 @@ {{ $type = $field.Type.Value}} {{ end }} // {{ $method.Name }} the {{ if $field.IsRequired }}required{{ else }}optional{{ end }} value of {{ $field.Name.GoCase }} - func (r {{ $struct }}) {{ $method.Name }}(value {{ if $method.IsList }}[]{{ end }}{{ $type }}) {{ $setReturnStruct }} { + func (r {{ $struct }}) {{ $method.Name }}(value {{ if $method.IsList }}[]{{ end }}{{ $type }}{{ if $field.Field.IsObjectType }}Type{{ end }}) {{ $setReturnStruct }} { return {{ $setReturnStruct }}{ data: builder.Field{ Name: "{{ $field.Name }}", @@ -331,7 +331,7 @@ {{ $returnStruct = (print $name "DefaultParam") }} {{ end }} - {{ if and $field.Kind.IncludeInStruct (not $field.Prisma) }} + {{ if and $field.IncludeInStruct (not $field.Prisma) }} {{/* Provide an `Equals` method for most types. */}} {{/* Equals has a special return type for individual fields */}} {{ $equalsReturnStruct := "" }} @@ -340,10 +340,10 @@ {{ else }} {{ $equalsReturnStruct = (print $name "WithPrisma" $field.Name.GoCase "EqualsParam") }} {{ end }} - func (r {{ $struct }}) Equals(value {{ if $field.IsList }}[]{{ end }}{{ $field.Type.Value }}) {{ $equalsReturnStruct }} { + func (r {{ $struct }}) Equals(value {{ if $field.IsList }}[]{{ end }}{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}) {{ $equalsReturnStruct }} { {{ if $field.IsList }} if value == nil { - value = []{{ $field.Type.Value }}{} + value = []{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}{} } {{ end }} return {{ $equalsReturnStruct }}{ @@ -359,7 +359,7 @@ } } - func (r {{ $struct }}) EqualsIfPresent(value {{ if $field.IsList }}[]{{ else }}*{{ end }}{{ $field.Type.Value }}) {{ $equalsReturnStruct }} { + func (r {{ $struct }}) EqualsIfPresent(value {{ if $field.IsList }}[]{{ else }}*{{ end }}{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}) {{ $equalsReturnStruct }} { if value == nil { return {{ $equalsReturnStruct }}{} } @@ -367,7 +367,7 @@ } {{ if and (not $field.IsRequired) (not $field.Prisma) }} - func (r {{ $struct }}) EqualsOptional(value *{{ $field.Type.Value }}) {{ $returnStruct }} { + func (r {{ $struct }}) EqualsOptional(value *{{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}) {{ $returnStruct }} { return {{ $returnStruct }}{ data: builder.Field{ Name: "{{ $field.Name }}", @@ -406,7 +406,7 @@ } } - func (r {{ $struct }}) Cursor(cursor {{ $field.Type.Value }}) {{ $name }}CursorParam { + func (r {{ $struct }}) Cursor(cursor {{ $field.Type.Value }}{{ if $field.Field.IsObjectType }}Type{{ end }}) {{ $name }}CursorParam { return {{ $name }}CursorParam{ data: builder.Field{ Name: "{{ $field.Name }}", diff --git a/generator/templates/types.gotpl b/generator/templates/types.gotpl index 2976dcdc..65bc854a 100644 --- a/generator/templates/types.gotpl +++ b/generator/templates/types.gotpl @@ -6,7 +6,7 @@ // {{ $type.Name.GoCase }}Type type {{ $type.Name.GoCase }}Type struct { {{ range $field := $type.Fields }} - {{- if not $field.Kind.IsRelation -}} + {{- if not $field.IsRelation -}} {{- if $field.IsRequired }} {{ $field.Name.GoCase }} {{ if $field.IsList }}[]{{ end }}{{ $field.Type.Value }} {{ $field.Name.Tag $field.IsRequired }} {{- else }} diff --git a/test/databases/mongodb/objects/default_test.go b/test/databases/mongodb/objects/default_test.go index a62ccd2f..ee195b43 100644 --- a/test/databases/mongodb/objects/default_test.go +++ b/test/databases/mongodb/objects/default_test.go @@ -20,55 +20,60 @@ func TestObjects(t *testing.T) { run Func }{{ name: "types", - // language=GraphQL - before: []string{` - mutation { - result: createOneUser(data: { - id: "id1", - email: "email1", - info: { - age: 0, - }, - infoOpt: { - age: 0, - }, - list: { - create: [ - { - age: 0, - }, - ] - } - }) { - id - } - } - `}, run: func(t *testing.T, client *PrismaClient, ctx cx) { - user, err := client.User.FindUnique( - User.ID.Equals("id1"), - ).Exec(ctx) - if err != nil { - t.Fatal(err) - } - - massert.Equal(t, &UserModel{ + expected := &UserModel{ InnerUser: InnerUser{ - ID: "id1", - Email: "email1", + ID: "id1", + Email: "email1", + Username: "username1", Info: InfoType{ - Age: 0, + Age: 5, + AgeOpt: 3, }, InfoOpt: &InfoType{ - Age: 0, + Age: 5, + AgeOpt: 3, }, List: []InfoType{ { - Age: 0, + Age: 5, + AgeOpt: 3, }, }, }, - }, user) + } + + user, err := client.User.CreateOne( + User.Email.Set("id1"), + User.Username.Set("id1"), + User.Info.Set(InfoType{ + Age: 5, + AgeOpt: 3, + }), + User.InfoOpt.Set(InfoType{ + Age: 5, + AgeOpt: 3, + }), + User.List.Set([]InfoType{{ + Age: 5, + AgeOpt: 3, + }}), + User.ID.Set("id1"), + ).Exec(ctx) + if err != nil { + t.Fatal(err) + } + + massert.Equal(t, expected, user) + + user, err = client.User.FindUnique( + User.ID.Equals("id1"), + ).Exec(ctx) + if err != nil { + t.Fatal(err) + } + + massert.Equal(t, expected, user) }, }} for _, tt := range tests { diff --git a/test/databases/mongodb/objects/schema.prisma b/test/databases/mongodb/objects/schema.prisma index 8c37b599..12388e8d 100644 --- a/test/databases/mongodb/objects/schema.prisma +++ b/test/databases/mongodb/objects/schema.prisma @@ -21,7 +21,8 @@ model User { } type Info { - age Int + age Int + ageOpt Int } // unused relation to check for conflicts etc.