Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/schema/src/res/stdlib.zmodel
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ attribute @db.Timetz(_ x: Int?) @@@targetField([DateTimeField]) @@@prisma

// Json type modifiers

attribute @db.Json() @@@targetField([JsonField]) @@@prisma
attribute @db.JsonB() @@@targetField([JsonField]) @@@prisma
attribute @db.Json() @@@targetField([JsonField, TypeDefField]) @@@prisma
attribute @db.JsonB() @@@targetField([JsonField, TypeDefField]) @@@prisma

// Bytes type modifiers

Expand Down
33 changes: 33 additions & 0 deletions tests/integration/tests/enhancements/json/typing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,37 @@ async function main() {
}
);
});

it('supports @db.Json and @db.JsonB', async () => {
await loadSchema(
`
type Profile {
age Int @gt(0)
}

model User {
id Int @id @default(autoincrement())
profile Profile @json @db.Json
posts Post[]
@@allow('all', true)
}

type Meta {
description String
}

model Post {
id Int @id @default(autoincrement())
title String
user User @relation(fields: [userId], references: [id])
userId Int
meta Meta @json @db.JsonB
}
`,
{
provider: 'postgresql',
pushDb: false,
}
);
});
});
Loading