prisma1-upgrade
prisma1-upgrade copied to clipboard
Prisma 1 Enum scalar lists error out
For example:
Prisma 1 Data Model
type EmailAddress {
id: ID! @id
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
name: String
email: String!
user: User @relation(link: INLINE)
deals: [Deal]
emailType: [EmailTypeEnum] @default(value: Current) @scalarList(strategy: RELATION)
emailOwnerEnum: OwnerEnum! @default(value: Buyer)
}
npx prisma introspect
model EmailAddress {
id String @default(cuid()) @id
createdAt DateTime
updatedAt DateTime
name String?
email String
emailOwnerEnum String
user String?
User User? @relation(fields: [user], references: [id])
EmailAddress_emailType EmailAddress_emailType[]
Deal Deal[]
}
npx prisma-upgrade
model EmailAddress {
id String @default(cuid()) @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String?
email String
emailOwnerEnum String
userId String? @map("user")
user User? @relation(fields: [user], references: [id])
EmailAddress_emailType EmailAddress_emailType[]
deals Deal[]
}
Errors out on the EmailAddress_emailType[]
Type "EmailAddress_emailType" is neither a built-in type, nor refers to another model, custom type, or enum.
Interesting. Are you running Postgres or MySQL?
Postgres. I'll continue poking at it and see if I can move this issue a little more forward. Thanks for your consideration and hard work!
Thanks! This should be possible in Postgres. Figuring out which SQL statement is broken for you and how to fix it would certainly speed things up.
Here's a nice example: https://github.com/prisma/upgrade/issues/75#issuecomment-676746087
Type "EmailAddress_emailType" is neither a built-in type, nor refers to another model, custom type, or enum.
What part errors out? The SQL, P1 client, or P2 client?
If it's the generated SQL, which SQL command are you running when it errors out?
I experienced this while implementing various fixes in our fork. See https://github.com/reibus/prisma-upgrade/pull/1/files#r894814148