valtyr / prisma-kysely

🪄 Generate Kysely types directly from your Prisma schema!
https://www.npmjs.com/package/prisma-kysely
MIT License
951 stars 36 forks source link

`npx prisma generate` does not remove fields for columns that are dropped #109

Closed desaxce closed 1 month ago

desaxce commented 1 month ago

I have a Prisma schema with a Kysely generator as follows:

generator kysely {
  provider     = "prisma-kysely"
  output       = "./generated/"
  enumFileName = "kysely-enums.ts"
  fileName     = "kysely.ts"
}

I used to be able to drop a column / table in a Prisma migration and running a npx prisma generate would properly update the kysely.ts by removing the fields that aren't in my table anymore (like a full alignment between my schema.prisma file and the kysely.ts.

Since a couple of weeks, the Kysely generated fields stay after I drop a column and generate the Kysely types anew with the above command.

No changes seem to have taken place on the prisma-kysely package since it's been inactive for 8 months. Could it be coming from a Prisma upgrade?

Having a 1-to-1 sync between schema and Kysely types really is a must.

desaxce commented 1 month ago

Turned out to be a mistake in a custom Kysely type /// kysely and npx prisma generate didn't complete.

Doesn't fail either, so tough to trace.