How to migrate from prisma client?
Closed this issue · 1 comments
tomaszferens commented
I have a lot of code that uses prisma client to do db queries. How can I gradually migrate to prisma-kysely? I want to have more control over the queries that are sent to the database (postgres, in my case).
This is how my schema.prisma
file looks like:
generator client {
provider = "prisma-client-js"
previewFeatures = ["jsonProtocol"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
I don't want to migrate to prisma-kysely overnight. I would rather do it endpoint by endpoint. Should I append this into schema.prisma
:
generator kysely {
provider = "prisma-kysely"
output = "../src/db"
fileName = "types.ts"
enumFileName = "enums.ts"
}
and leave generator client
definition until I migrate all the code to kysely? I cannot just remove generator client
, right?
valtyr commented
Yup you got that right. Prisma supports multiple generators, so adding prisma-kysely
won't affect your existing prisma-client-js code. You should be able to gradually transition that way.