File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
tests/integration/tests/enhancements/json Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -505,8 +505,8 @@ attribute @db.Timetz(_ x: Int?) @@@targetField([DateTimeField]) @@@prisma
505
505
506
506
// Json type modifiers
507
507
508
- attribute @db.Json () @@@targetField([JsonField]) @@@prisma
509
- attribute @db.JsonB() @@@targetField([JsonField]) @@@prisma
508
+ attribute @db.Json () @@@targetField([JsonField, TypeDefField ]) @@@prisma
509
+ attribute @db.JsonB() @@@targetField([JsonField, TypeDefField ]) @@@prisma
510
510
511
511
// Bytes type modifiers
512
512
Original file line number Diff line number Diff line change @@ -385,4 +385,37 @@ async function main() {
385
385
}
386
386
) ;
387
387
} ) ;
388
+
389
+ it ( 'supports @db.Json and @db.JsonB' , async ( ) => {
390
+ await loadSchema (
391
+ `
392
+ type Profile {
393
+ age Int @gt(0)
394
+ }
395
+
396
+ model User {
397
+ id Int @id @default(autoincrement())
398
+ profile Profile @json @db.Json
399
+ posts Post[]
400
+ @@allow('all', true)
401
+ }
402
+
403
+ type Meta {
404
+ description String
405
+ }
406
+
407
+ model Post {
408
+ id Int @id @default(autoincrement())
409
+ title String
410
+ user User @relation(fields: [userId], references: [id])
411
+ userId Int
412
+ meta Meta @json @db.JsonB
413
+ }
414
+ ` ,
415
+ {
416
+ provider : 'postgresql' ,
417
+ pushDb : false ,
418
+ }
419
+ ) ;
420
+ } ) ;
388
421
} ) ;
You can’t perform that action at this time.
0 commit comments