From cf7863642d3bf0fccf87fe1c3387c778e6aef860 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:03:29 -0800 Subject: [PATCH 1/2] blog: update json type guide --- blog/json-typing/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog/json-typing/index.md b/blog/json-typing/index.md index 094e127c..54ce39cb 100644 --- a/blog/json-typing/index.md +++ b/blog/json-typing/index.md @@ -164,4 +164,4 @@ const images = await db.image.findMany({ }); ``` -Is it useful, or can it be confusing (as it looks the same as relation filters)? Let us know by leaving a comment below. +Is it useful, or can it be confusing (as it looks the same as relation filters)? Let us know by leaving a comment below. You can also learn more about this feature in the [official guide](https://zenstack.dev/docs/guides/typing-json). From 96b57539e43bb3a388a7ad6ad325642894b33bc7 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:10:31 -0800 Subject: [PATCH 2/2] truncate --- blog/json-typing/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blog/json-typing/index.md b/blog/json-typing/index.md index 54ce39cb..58c45b68 100644 --- a/blog/json-typing/index.md +++ b/blog/json-typing/index.md @@ -15,6 +15,8 @@ SQL databases provide us with many benefits, the most important of which is stro However, once in a while, we want to break free from such strong guarantees for valid reasons. You may have some tiny objects that you want to attach to the main entities (e.g., metadata of an image) without formalizing them into a separate table. Or you need to store records with many possible sparse fields but want to avoid creating wide tables. + + Prisma's JSON type provides a generic escape hatch for such scenarios. It allows storing arbitrary data and gives you a generic `JsonValue` type in the query results. ```zmodel title="schema.prisma"