Greetings, and of course an associated question! H...
# orm-help
w
Greetings, and of course an associated question! Hurray, another question, just like you wanted! I'm trying to get Prisma1 to play along side Prisma2, and I have a Prisma2 schema that looks like this:
Copy code
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)
}
And in a Prisma1 GraphQL Playground I run this:
Copy code
mutation ($data: UserCreateInput!) {
  createuser(data: $data) {
    id
    email
  }
}
variables
{
  "data" {
    "email": "<mailto:diety@supremebeing.org|diety@supremebeing.org>"
    "admin": {
      "create": {
        "name": "me"
      }
    }
  }
}
And I get an error about
(conn=3216) Field 'userId' doesn't have a default value
I also checked in MySQL and the foreign key constraint in
Admin
for
userId
references
id
in
User
Why isn't Prisma1 inserting
userId
into
Admin
when I create a user with a nested create for
Admin
? Is that something that Prisma1 can't do?