File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 30
30
31
31
Ref: Profile.userId - User.id
32
32
33
- Ref: Post.authorId - User.id
33
+ Ref: Post.authorId > User.id
Original file line number Diff line number Diff line change @@ -75,11 +75,23 @@ const generateRefs = (models: DMMF.Model[]): string[] => {
75
75
. forEach ( ( field ) => {
76
76
const relatedTables = field . relationName ! ! . split ( 'To' ) ;
77
77
refs . push (
78
- `Ref: ${ relatedTables [ 0 ] } .${ ( field as any ) . relationFromFields [ 0 ] } - ${
78
+ `Ref: ${ relatedTables [ 0 ] } .${
79
+ ( field as any ) . relationFromFields [ 0 ]
80
+ } ${ getRefOperator ( models , relatedTables [ 1 ] , relatedTables [ 0 ] ) } ${
79
81
relatedTables [ 1 ]
80
82
} .${ field . relationToFields ! ! [ 0 ] } `
81
83
) ;
82
84
} ) ;
83
85
} ) ;
84
86
return refs ;
85
87
} ;
88
+
89
+ const getRefOperator = (
90
+ models : DMMF . Model [ ] ,
91
+ from : string ,
92
+ to : string
93
+ ) : string => {
94
+ const model = models . find ( ( model ) => model . name === from ) ;
95
+ const field = model ?. fields . find ( ( field ) => field . type === to ) ;
96
+ return field ?. isList ? '>' : '-' ;
97
+ } ;
You can’t perform that action at this time.
0 commit comments