prisma / studio

🎙️ The easiest way to explore and manipulate your data in all of your Prisma projects.
https://www.prisma.io/studio
1.87k stars 48 forks source link

Can't add record that gets connected to another existing record upon creating #257

Closed nikolasburk closed 4 years ago

nikolasburk commented 4 years ago

I am trying to create a new Item record and connect it to an existing ItemType record based on these models:

model Item {
  id           String   @default(cuid()) @id
  createdAt    DateTime @default(now())
  updatedAt    DateTime @updatedAt
  purchaseDate DateTime?
  name         String
  type         ItemType
  locatedIn    Room?
  invoice      Invoice?
  price        Float?
}

model ItemType {
  id    String @default(cuid()) @id
  name  String @unique
  items Item[]
}

However, the Item record can't be created:

Provide values for all fields

Before commit

image

After commit

image

Provide values only for required fields: name and type

Before commit

image

After commit

image

This is the warning message that was printed:

All actions were not processed. Pending actions:  {
  "Item": {
    "Item::2154fb85-6945-42dc-ad6a-a951267fe124": {
      "update": {
        "type": {
          "connect": "ItemType::ck23c7p44000014cbspsiwuuw"
        }
      }
    }
  }
}
Photon requests:  "photon.items.create(
{
  "data": {
    "name": "Some item"
  },
  "select": {
    "id": true,
    "name": true
  }
}
)"
  1. Prisma2 version (prisma2 -v):
prisma2@2.0.0-preview015, binary version: 20b6dc13949cccccfef5be07c0be7a3d7c858abe
sdnts commented 4 years ago

@nikolasburk alpha.337 should have a fix for this, please give it a shot and let me know if you're still seeing this!

sdnts commented 4 years ago

Going to close this, I think this is fixed. Please reopen otherwise!

bek-shoyatbek commented 5 months ago

Did you find the solution , I'm facing the same problem