Data type JSON
See original GitHub issueWhen converting the following datamodel:
type A {
id: ID! @unique
text: String!
meta: JSON!
}
Using the following method:
cat datamodel.graphql | prisma2 convert > schema.prisma
I get the following schema:
model A {
id String @default(cuid()) @id @unique
text String
}
As we can see, the meta: JSON
attribute is missing
Issue Analytics
- State:
- Created 4 years ago
- Reactions:27
- Comments:30 (9 by maintainers)
Top Results From Across the Web
JSON Data Types - W3Schools
Valid Data Types. In JSON, values must be one of the following data types: a string; a number; an object (JSON object); an...
Read more >JSON - DataTypes - Tutorialspoint
JSON - DataTypes, JSON format supports the following data types −
Read more >MySQL 8.0 Reference Manual :: 11.5 The JSON Data Type
MySQL supports a native JSON data type defined by RFC 7159 that enables efficient access to data in JSON (JavaScript Object Notation) documents....
Read more >JSON Data Types - REST
At the granular level, JSON consists of 6 data types. The first four data types (string, number, boolean and null) can be referred...
Read more >Documentation: 15: 8.14. JSON Types - PostgreSQL
JSON data types are for storing JSON (JavaScript Object Notation) data, as specified in RFC 7159. Such data can also be stored as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here is a summary of what we implemented so far:
Prisma Schema The data type for JSON is called
Json
in the schema. It can be used like this:It is supported by the MySQL and Postgres connectors. It is not supported by SQLite.
Introspection The
prisma introspect
command maps the following column types toJson
:json
andjsonb
JSON
Migrations
prisma migrate
uses the following data type when creating a column for a field of typeJson
:jsonb
JSON
Prisma Client A field of type
Json
are exposed as proper objects in Javascript.Important Details JSON support for MySQL is only supported for versions greater than 5.6. As we don’t have version information available during schema validation no error is shown in this case. However we have version information available in
prisma migrate
. Therefore we error when a migration against MySQL 5.6 uses theJson
data type.Hey! Do you guys happen to have an ETA on this feature?