-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
The generated type Json = ColumnType<JsonValue, string, string>
should just be JsonValue
for Postgres.
#124
Comments
That is, both of these work:
|
I came here to post this exact issue. I changed the generated types and it works flawlessly (at least for insertion). In fact, it works better than inserting a string because (at least in JS/TS) stringifying an object escapes the double quotes, therefore taking up significantly more space than needed. I wouldn't be surprised if that also causes us to lose the SQL optimizations and indexing abilities. In essence, I echo the OP |
Pushed a PR, I'm expecting that to work. @RobinBlomberg would love a 👍🏼! |
- also: - bumps kysely-codegen for proper JSON typing (see: RobinBlomberg/kysely-codegen#124) - fixes off-by-one error in parabol/packages/server/postgres/migrations/1677272969994_meetingTemplatesMove.ts to avoid copying a bad pattern – I wonder if this should become a helper function instead?
- also: - bumps kysely-codegen for proper JSON typing (see: RobinBlomberg/kysely-codegen#124) - fixes off-by-one error in parabol/packages/server/postgres/migrations/1677272969994_meetingTemplatesMove.ts to avoid copying a bad pattern – I wonder if this should become a helper function instead?
If I'm not mistaken, the generated json type
type Json = ColumnType<JsonValue, string, string>
seems to be overly restrictive for Postgres, as I can use kysely to insert and updateJsonValue
values, in addition to strings. SinceJsonValue | string
is justJsonValue
, the whole thing can be collapsedtype Json = JsonValue
.Upvote & Fund
The text was updated successfully, but these errors were encountered: