@@ -323,7 +323,7 @@ export type OrderBy<
323323 } )
324324 : { } ) ;
325325
326- export type WhereUnique <
326+ export type WhereUniqueInput <
327327 Schema extends SchemaDef ,
328328 Model extends GetModels < Schema >
329329> = AtLeast <
@@ -336,7 +336,8 @@ export type WhereUnique<
336336 Schema ,
337337 GetModel < Schema , Model > [ 'uniqueFields' ] [ Key ]
338338 >
339- : {
339+ : // multi-field unique
340+ {
340341 [ Key1 in keyof GetModel <
341342 Schema ,
342343 Model
@@ -373,7 +374,7 @@ type Distinct<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
373374} ;
374375
375376type Cursor < Schema extends SchemaDef , Model extends GetModels < Schema > > = {
376- cursor ?: WhereUnique < Schema , Model > ;
377+ cursor ?: WhereUniqueInput < Schema , Model > ;
377378} ;
378379
379380type Select <
@@ -591,7 +592,7 @@ export type FindUniqueArgs<
591592 Schema extends SchemaDef ,
592593 Model extends GetModels < Schema >
593594> = {
594- where ?: WhereUnique < Schema , Model > ;
595+ where ?: WhereUniqueInput < Schema , Model > ;
595596} & SelectIncludeOmit < Schema , Model , true > ;
596597
597598//#endregion
@@ -711,7 +712,7 @@ type ConnectOrCreatePayload<
711712 Schema extends SchemaDef ,
712713 Model extends GetModels < Schema >
713714> = {
714- where : WhereUnique < Schema , Model > ;
715+ where : WhereUniqueInput < Schema , Model > ;
715716 create : CreateInput < Schema , Model > ;
716717} ;
717718
@@ -768,7 +769,7 @@ export type UpdateArgs<
768769 Model extends GetModels < Schema >
769770> = {
770771 data : UpdateInput < Schema , Model > ;
771- where : WhereUnique < Schema , Model > ;
772+ where : WhereUniqueInput < Schema , Model > ;
772773 select ?: Select < Schema , Model , true > ;
773774 include ?: Include < Schema , Model > ;
774775 omit ?: OmitFields < Schema , Model > ;
@@ -789,7 +790,7 @@ export type UpsertArgs<
789790> = {
790791 create : CreateInput < Schema , Model > ;
791792 update : UpdateInput < Schema , Model > ;
792- where : WhereUnique < Schema , Model > ;
793+ where : WhereUniqueInput < Schema , Model > ;
793794 select ?: Select < Schema , Model , true > ;
794795 include ?: Include < Schema , Model > ;
795796 omit ?: OmitFields < Schema , Model > ;
@@ -858,25 +859,44 @@ type UpdateRelationFieldPayload<
858859 Schema extends SchemaDef ,
859860 Model extends GetModels < Schema > ,
860861 Field extends RelationFields < Schema , Model >
861- > = Omit <
862- {
863- create ?: NestedCreateInput < Schema , Model , Field > ;
864- createMany ?: NestedCreateManyInput < Schema , Model , Field > ;
865- connect ?: ConnectInput < Schema , Model , Field > ;
866- connectOrCreate ?: ConnectOrCreateInput < Schema , Model , Field > ;
867- disconnect ?: DisconnectInput < Schema , Model , Field > ;
868- set ?: SetInput < Schema , Model , Field > ;
869- update ?: NestedUpdateInput < Schema , Model , Field > ;
870- upsert ?: NestedUpsertInput < Schema , Model , Field > ;
871- updateMany ?: NestedUpdateManyInput < Schema , Model , Field > ;
872- delete ?: NestedDeleteInput < Schema , Model , Field > ;
873- deleteMany ?: NestedDeleteManyInput < Schema , Model , Field > ;
874- } ,
875- // no "createMany" for non-array fields
876- FieldIsArray < Schema , Model , Field > extends true
877- ? never
878- : 'createMany' | 'set'
879- > ;
862+ > = FieldIsArray < Schema , Model , Field > extends true
863+ ? ToManyRelationUpdateInput < Schema , Model , Field >
864+ : ToOneRelationUpdateInput < Schema , Model , Field > ;
865+
866+ type ToManyRelationUpdateInput <
867+ Schema extends SchemaDef ,
868+ Model extends GetModels < Schema > ,
869+ Field extends RelationFields < Schema , Model >
870+ > = {
871+ create ?: NestedCreateInput < Schema , Model , Field > ;
872+ createMany ?: NestedCreateManyInput < Schema , Model , Field > ;
873+ connect ?: ConnectInput < Schema , Model , Field > ;
874+ connectOrCreate ?: ConnectOrCreateInput < Schema , Model , Field > ;
875+ disconnect ?: DisconnectInput < Schema , Model , Field > ;
876+ update ?: NestedUpdateInput < Schema , Model , Field > ;
877+ upsert ?: NestedUpsertInput < Schema , Model , Field > ;
878+ updateMany ?: NestedUpdateManyInput < Schema , Model , Field > ;
879+ delete ?: NestedDeleteInput < Schema , Model , Field > ;
880+ deleteMany ?: NestedDeleteManyInput < Schema , Model , Field > ;
881+ set ?: SetRelationInput < Schema , Model , Field > ;
882+ } ;
883+
884+ type ToOneRelationUpdateInput <
885+ Schema extends SchemaDef ,
886+ Model extends GetModels < Schema > ,
887+ Field extends RelationFields < Schema , Model >
888+ > = {
889+ create ?: NestedCreateInput < Schema , Model , Field > ;
890+ connect ?: ConnectInput < Schema , Model , Field > ;
891+ connectOrCreate ?: ConnectOrCreateInput < Schema , Model , Field > ;
892+ update ?: NestedUpdateInput < Schema , Model , Field > ;
893+ upsert ?: NestedUpsertInput < Schema , Model , Field > ;
894+ } & ( FieldIsOptional < Schema , Model , Field > extends true
895+ ? {
896+ disconnect ?: DisconnectInput < Schema , Model , Field > ;
897+ delete ?: NestedDeleteInput < Schema , Model , Field > ;
898+ }
899+ : { } ) ;
880900
881901// #endregion
882902
@@ -886,7 +906,7 @@ export type DeleteArgs<
886906 Schema extends SchemaDef ,
887907 Model extends GetModels < Schema >
888908> = {
889- where : WhereUnique < Schema , Model > ;
909+ where : WhereUniqueInput < Schema , Model > ;
890910 select ?: Select < Schema , Model , true > ;
891911 include ?: Include < Schema , Model > ;
892912 omit ?: OmitFields < Schema , Model > ;
@@ -1099,8 +1119,8 @@ type ConnectInput<
10991119 Model extends GetModels < Schema > ,
11001120 Field extends RelationFields < Schema , Model >
11011121> = FieldIsArray < Schema , Model , Field > extends true
1102- ? OrArray < WhereUnique < Schema , RelationFieldType < Schema , Model , Field > > >
1103- : WhereUnique < Schema , RelationFieldType < Schema , Model , Field > > ;
1122+ ? OrArray < WhereUniqueInput < Schema , RelationFieldType < Schema , Model , Field > > >
1123+ : WhereUniqueInput < Schema , RelationFieldType < Schema , Model , Field > > ;
11041124
11051125type ConnectOrCreateInput <
11061126 Schema extends SchemaDef ,
@@ -1121,16 +1141,16 @@ type DisconnectInput<
11211141 Field extends RelationFields < Schema , Model >
11221142> = FieldIsArray < Schema , Model , Field > extends true
11231143 ? OrArray <
1124- WhereUnique < Schema , RelationFieldType < Schema , Model , Field > > ,
1144+ WhereUniqueInput < Schema , RelationFieldType < Schema , Model , Field > > ,
11251145 true
11261146 >
11271147 : boolean | WhereInput < Schema , RelationFieldType < Schema , Model , Field > > ;
11281148
1129- type SetInput <
1149+ type SetRelationInput <
11301150 Schema extends SchemaDef ,
11311151 Model extends GetModels < Schema > ,
11321152 Field extends RelationFields < Schema , Model >
1133- > = OrArray < WhereUnique < Schema , RelationFieldType < Schema , Model , Field > > > ;
1153+ > = OrArray < WhereUniqueInput < Schema , RelationFieldType < Schema , Model , Field > > > ;
11341154
11351155type NestedUpdateInput <
11361156 Schema extends SchemaDef ,
@@ -1139,7 +1159,7 @@ type NestedUpdateInput<
11391159> = FieldIsArray < Schema , Model , Field > extends true
11401160 ? OrArray <
11411161 {
1142- where : WhereUnique <
1162+ where : WhereUniqueInput <
11431163 Schema ,
11441164 RelationFieldType < Schema , Model , Field >
11451165 > ;
@@ -1153,7 +1173,7 @@ type NestedUpdateInput<
11531173 >
11541174 : XOR <
11551175 {
1156- where : WhereUnique <
1176+ where : WhereUniqueInput <
11571177 Schema ,
11581178 RelationFieldType < Schema , Model , Field >
11591179 > ;
@@ -1176,7 +1196,7 @@ type NestedUpsertInput<
11761196 Field extends RelationFields < Schema , Model >
11771197> = OrArray <
11781198 {
1179- where : WhereUnique < Schema , Model > ;
1199+ where : WhereUniqueInput < Schema , Model > ;
11801200 create : CreateInput <
11811201 Schema ,
11821202 RelationFieldType < Schema , Model , Field > ,
@@ -1213,7 +1233,7 @@ type NestedDeleteInput<
12131233 Field extends RelationFields < Schema , Model >
12141234> = FieldIsArray < Schema , Model , Field > extends true
12151235 ? OrArray <
1216- WhereUnique < Schema , RelationFieldType < Schema , Model , Field > > ,
1236+ WhereUniqueInput < Schema , RelationFieldType < Schema , Model , Field > > ,
12171237 true
12181238 >
12191239 : boolean | WhereInput < Schema , RelationFieldType < Schema , Model , Field > > ;
0 commit comments