blitz-js / legacy-framework

MIT License
3 stars 2 forks source link

`blitz generate model` messes up uses of `@db.Text` #373

Closed flybayer closed 2 years ago

flybayer commented 2 years ago

What is the problem?

If you have any use of @db.Text inside your prisma schema, running blitz generate model newModelName will change @db.Text to @Text` which is a bug.

What are detailed steps to reproduce this?

Start with this in your schema

model TestB {
  id                 String    @id @default(cuid())
  longField     String?   @db.Text
}

Then run blitz generate model testA. It will convert above use of @db.Text to @Text`

(Note I'm using mysql)

Run blitz -v and paste the output here:

0.44.0

MrLeebo commented 2 years ago

https://github.com/blitz-js/blitz/blob/831b0d4bcd848106ede5b539c96d8b48ea577ac9/packages/generator/package.json#L37

@flybayer it looks like this is because blitz generator has the version of prisma-ast hardcoded to v0.2.4, and that bug was fixed in the next release:

blitz/packages/generator/package.json
-"@mrleebo/prisma-ast": "0.2.4",
+"@mrleebo/prisma-ast": "^0.2.5",

Should be easily fixed by updating the dependency