prisma/prisma1-upgrade

Validation errors after upgrading

matthewmueller opened this issue · 1 comments

Right now, if you have a large enough schema, you'll get some validation errors after upgrading. This is expected.

For example:

image (19)

Unfortunately, there's a long tail of little tweaks required that add up to more time than we want to invest on this tool.

The recommended approach is to just do what the formatter asks of you. In the case above, you'd remove @map where it tells you to.

You also may notice that some of the names are weird. You are free to name these fields however you wish. This will allow you to generate a better Prisma Client. For example if we changed transcoderId to transcoders, your generated API will change to:

prisma.liveinfos.findOne(...).transcoders() 

Feel free to drop other issues in here and we'll try to help you out. When in doubt, follow what the formatter says!

sktt commented

We're also getting lots of

error: Error validating: The argument fields must refer only to scalar fields. But it is referencing the following relation fields: recurring_subscription
  -->  schema.prisma:18
   |
17 |   recurring_subscriptionId String?                @map("recurring_subscription")
18 |   recurring_subscription   RecurringSubscription? @relation(fields: [recurring_subscription], references: [id])
19 |   Refund                   Refund[]

Changing fields: [recurring_subscription] to fields: [recurring_subscriptionId] fixes the issue. seems like fields associates with the "mapped" value and not with the "real" value