Prisma Create with Connect Issue

Hey!

I wasn't able to find another thread explaining this, but I'd love help with this!

I have two tables in my database right now, they are Org and OrgType (in Prisma). Here is how they look right now:

model Org {
  id             String  @id @default(cuid())
  albatrossOrgId Int     @map("albatross_org_id") //albatross org id
  name           String
  nickname       String?
  parentOrgId    String? @map("parent_org_id")
  orgType        OrgType @relation(references: [id], fields: [orgTypeId])
  orgTypeId      String  @map("org_type_id") //scalar fields above

  // Data Upkeep
  createdBy    String?   @map("created_by")
  modifiedBy   String?   @map("modified_by")
  createdDate  DateTime  @default(now()) @map("created_date")
  modifiedDate DateTime? @updatedAt @map("modified_date")
  activeFlag   Boolean   @default(true) @map("active_flag")
  archiveFlag  Boolean   @default(false) @map("archive_flag")

  // Relational Fields

  // Relational Indexes
  @@index([orgTypeId])
  // Naming
  @@map("org")
}

model OrgType {
  id           String  @id @default(cuid())
  name         String
  parentTypeId String? @map("parent_type_id")

  // Data Upkeep
  createdBy    String?   @map("created_by")
  modifiedBy   String?   @map("modified_by")
  createdDate  DateTime  @default(now()) @map("created_date")
  modifiedDate DateTime? @updatedAt @map("modified_date")
  activeFlag   Boolean   @default(true) @map("active_flag")
  archiveFlag  Boolean   @default(false) @map("archive_flag")

  // Relational Fields
  Org Org[]

  // Relational Indexes

  // Naming
  @@map("org_type")
}


I'm using the T3 stack going off the Chirp tutorial video (I'm a noob at js), and I'm trying to insert into the Org table, which has the orgTypeId that I need to insert (this is selected via a dropdown on the client side).

Any help would be greatly appreciated!
Was this page helpful?