insert query in kysely, typerror
Hi, I try to migrate from prisma to kysely, only use Prisma for generating the types. Currently I have a insert into db like this with prisma api
I tried to do it like this with Kysely but it gives me errors: Object literal may only specify known properties, and 'votedAgainstId' does not exist in type 'InsertObjectOrListFactory<Database, "VoteAnime">'. Anyone maybe know how to fix this?
2 Replies
to give more context the this is vote anime type:
after some research I changed the type to this interface but now I get error:
Field 'id' doesn't have a default value
when trying to fire mutation. when constructing the prisma schema and pushing it to database I chosed so I guess it should have a default value?Hey 👋
You should try https://github.com/valtyr/prisma-kysely to not manage Kysely types yourself.
Also check out this section https://github.com/valtyr/prisma-kysely#gotchas, related to default values and why you're getting
doesn't have a default value
errors.GitHub
GitHub - valtyr/prisma-kysely: 🪄 Generate Kysely types directly fro...
🪄 Generate Kysely types directly from your Prisma schema! - GitHub - valtyr/prisma-kysely: 🪄 Generate Kysely types directly from your Prisma schema!