You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
INSERT INTO "authors" ("name", "stageName") VALUES ($1, $2) RETURNING to_jsonb("authors".*) AS result // column "stageName" of relation "authors" does not exist
Related to #169 - if the nullable property had to be specified, I'd get Property 'stage_name' is missing in type 'Author' but required in type 'Insertable'.. That could prevent the error, unless I decided to add that property by using spread operator. Using an object-literal in that case would be safe.
However, it could be nice if there was a check for that - maybe even in runtime - to see if all the columns actually exist and filter out the imaginary columns. That should work because a TS interface checks in all the required fields are there, and the runtime filter removes any excess fields.
Is this doable? I don't know if the query generator has access to the schema.
The text was updated successfully, but these errors were encountered:
I understand that it might be difficult because of how typescript interfaces work. Anyway:
Assume the following schema:
I might have my own Author type:
Then, I might forget about mapping my type to Insertable and try to insert my type directly. The type system will allow it:
The generated query will break:
Related to #169 - if the nullable property had to be specified, I'd get
Property 'stage_name' is missing in type 'Author' but required in type 'Insertable'.
. That could prevent the error, unless I decided to add that property by using spread operator. Using an object-literal in that case would be safe.However, it could be nice if there was a check for that - maybe even in runtime - to see if all the columns actually exist and filter out the imaginary columns. That should work because a TS interface checks in all the required fields are there, and the runtime filter removes any excess fields.
Is this doable? I don't know if the query generator has access to the schema.
The text was updated successfully, but these errors were encountered: