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
Data type JSON #186
Comments
JSON type is currently not supported in the datamodel. We may support it via native database types. Marking this as a feature request. |
@pantharshit00 Any update on whether you will be supporting the |
Would love to see this feature! |
We surely have an intent to support this via native database types we have introduced in the schema: https://github.com/prisma/specs/tree/master/schema#type-specifications So the model User {
id String @id @default(uuid())
misc String @pg.JSON
} |
@pantharshit00 Sounds promising! If you do implement this, could you guys make sure to provide examples of how it will work with Nexus? |
Any updates on if/when this feature will be implemented? |
just ran into this while migrating from prisma 1 to 2. This has effectively stopped the migration process for us. |
@chrisdrackett I'm just storing the stringified JSON for now until they implement the JSON type. |
yep, I'm doing the same. I have a bit more |
Commenting to know when anything changes. I am trying to move from Sequelize and need the JSON data type in MySQL. Migration was a breeze (30 mins for 46 tables and relations in about every table) except for the JSON type. :) |
The spec work is still ongoing. Latest work can be tracked in this PR in the specs repository: prisma/specs#291 |
@chrisdrackett not that it matters much, but your approach might appear to have some advantages :) https://www.youtube.com/watch?v=ff4fgQxPaO0 |
Internal Note: Dropping from current sprint, and picking up later. |
Hey! Do you guys happen to have an ETA on this feature? |
Great to see this in the Beta 3 milestone. Does anyone have any suggestions for a quick and dirty workaround for upgrading a prisma1 project in the meantime? |
Hey! You could use the string type with JSON.stringify for the time 😃 |
Thanks - that's what I'm planning but hoped there was something "more smarter" 🤓 |
Is this closed because this is a wontfix now? JSONB support would be really awesome to get in! |
its now supported in beta4 😃 (i can only speak for postgres users) |
Ah, great. Where do you see documentation of JSON support for I can't see anything in the release notes: |
i just saw that the issue was closed and gave everything worked out and i got |
Please follow https://github.com/prisma/prisma/issues/2322 for documentation update for JSON support. Please note there is still ongoing work there like filtering support. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Here is a summary of what we implemented so far: Prisma Schema model Blog {
id Int @id
json Json
} It is supported by the MySQL and Postgres connectors. It is not supported by SQLite. Introspection
Migrations
Prisma Client Important Details |
Thank you for the summary! Should the field type be returned as a JSON object as opposed to a JavaScript For example, my API type checks that the return values for an API method are valid JSON objects and returning an This is maybe not 100% a proper JSON value type (I'm unsure about export type JSONValue =
| string
| number
| boolean
| null
| undefined
| JSONArray
| JSONObject
export type JSONArray = Array<JSONValue>
export type JSONObject = {
[key: string]: JSONValue
} If you think this is worthwhile, I will open a separate issue for it. |
@thesunny Can you please open an issue about this on the client repository(https://github.com/prisma/prisma-client-js)? The typescript typing is unrelated to the engines implementation so it is better to track this separately. Also, better typing suggestions are always welcomed :) |
How about JSON support in prisma v2? |
@gustawdaniel Was added back in beta.4 already: https://github.com/prisma/prisma/releases/tag/2.0.0-beta.4 So can be used now of course! |
Thanks @janpio So I have rather problem with https://stackoverflow.com/questions/62730081/how-to-use-json-type-in-prisma-graphql-nexus-framework |
When converting the following datamodel:
Using the following method:
I get the following schema:
As we can see, the
meta: JSON
attribute is missingThe text was updated successfully, but these errors were encountered: