Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to correctly use @default for JSON columns #5494

Closed
SevInf opened this issue Nov 24, 2023 · 2 comments
Closed

Document how to correctly use @default for JSON columns #5494

SevInf opened this issue Nov 24, 2023 · 2 comments
Labels
docs Documentation creation, updates or corrections

Comments

@SevInf
Copy link
Contributor

SevInf commented Nov 24, 2023

JSON values in @default() should be quoted:

history Json @default("[]")

See prisma/prisma#22063.

That makes sense with the way JSON is handled one the engine side, however, for TS users this is not as obvious, as they always receive JSON as a parsed values. I haven't found explicit mention of this in either JSON or @default documentation.

@SevInf SevInf added the docs Documentation creation, updates or corrections label Nov 24, 2023
@applemate
Copy link

I tried this, and the default value still null. Not the array we wanted.

@nikolasburk
Copy link
Member

Created the PR for this here: #6121

@linear linear bot closed this as completed Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation creation, updates or corrections
Projects
None yet
Development

No branches or pull requests

3 participants