After upgrading to Prisma2 should Psima1 still be able to create relation in nested create?

Viewed 40

I'm attempting to upgrade Prisma from 1 to 2, opting to run prisma1 (1.34.12) along-side Prisma2 (3.4.1)

My problem is that after upgrading the MySQL DB and schema, my prisma1 queries are failing when trying to create nested creates in relation tables.

Example (paraphrased) Prisma2 schema:

model User {
  id     String  @id @default(cuid()) @db.Char(30)
  email  String  @db.MediumText
  admin  Admin?
}
model Admin {
  id     String  @id @default(cuid()) @db.Char(30)
  name   String  @db.MediumText
  userId String  @db.Char(30)
  user   User    @relation(fields: [userId], references: [id], onUpdate: Restrict)
}

Example (paraphrased) Prisma1 query:

mutation ($data: UserCreateInput!) {
  createuser(data: $data) {
    id
    email
  }
}
variables
{
  "data" {
    "email": "diety@supremebeing.org"
    "admin": {
      "create": {
        "name": "me"
      }
    }
  }
}

The (paraphrased) error I get:

(conn=3216) Field 'userId' doesn't have a default value

This section of the schema-incompatibilities prisma-upgrade doc seems to indicate that, after updating the schema and MySQL DB via the directions in the work-around, prisma1 should stick the userId into that Admin table based on the foreign key constraint, shouldn't it?

https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-prisma-1/schema-incompatibilities-postgres#all-non-inline-relations-are-recognized-as-m-n

How might I get my prisma1 queries/mutations to play in the Prisma2-upgraded DB?

Thank you!

0 Answers
Related