Migrating from Prisma client to Kysely issue
I am evaluating various aspects of changing from Prisma client to Kysely but i seem to have hit a small snag
basic tutorial i followed was from nexxel https://www.nexxel.dev/blog/typesafe-database
in my prisma schema i have
in prisma i was able to do this
but in Kysely its forcing me to add id and updated at otherwise it overloads saying it needs id and updatedAt
I tried reading the kysely documentation but couldnt find it personally
11 Replies
my understanding is that the type def given to kysely shows id and updated as mandatory fields ill post that setup as well (more or less the same from the nexxel post)
and the type is
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Ahhh ty
Where is generated from?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
looks good, do you have any way to handle this, i think the appeal of prisma was generating all these things on the fly and it automagically working
guess this might be a noob TS question but whats the sane way to extend the recipe type to overide id and updated at?
i think the appeal of prisma was generating all these things on the fly and it automagically workingthere's a 3rd party library just for that https://github.com/RobinBlomberg/kysely-codegen
GitHub
GitHub - RobinBlomberg/kysely-codegen: Generate Kysely type definit...
Generate Kysely type definitions from your database - GitHub - RobinBlomberg/kysely-codegen: Generate Kysely type definitions from your database
awesome ill take a look at that
that id field should probably be defined as
GeneratedAlways<string>
to make it read-only.
guess this might be a noob TS question but whats the sane way to extend the recipe type to overide id and updated at?probably
Omit<Recipe, 'id' | 'updatedAt'> & { id: SomeType, updatedAt: SomeOtherType }
awesome thanks for both of your help
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The cohesiveness and dx is fantastic, just seeing how many ms I can shave off.
Having problems with vercel and netlify though which is wild to me