I get this ```[ Error: Invalid `prisma.advertiser...
# orm-help
n
I get this
Copy code
[  Error: Invalid `prisma.advertiser.create()` invocation:
  The change you are trying to make would violate the required relation 'AdvertiserToUser' between the `Advertiser` and `User` models.
r
Hey @Nischal 👋 Could you try by creating your model like this?
Copy code
model User {
  id        Int         @default(autoincrement()) @id
  email     String?     @unique
  fullName  String?
  password  String?
  userRole  String?
  advertise Advertiser?
}

model Advertiser {
  id                   Int      @default(autoincrement()) @id
  companyContactNumber String?
  companyName          String?
  location             String?
  registeredNumber     Int?
  verified             Boolean?
  userId               Int
  createdBy            User     @relation(fields: [userId], references: [id])
}
n
Thanks much, this seems like a correct way.
Just tried and this works.
💯 1
🙂