#The column `new` does not exist in the current database.

4 messages · Page 1 of 1 (latest)

hollow forge
#

Error:

ERROR [ExceptionsHandler] PrismaClientKnownRequestError: 
Invalid `tx.order.create()` invocation in \app.service.js:94:46

  91 }
  92 try {
  93     return this.prisma.$transaction(async (tx) => {
→ 94         const order = await tx.order.create(
The column `new` does not exist in the current database.
    at handleRequestError (\node_modules\@prisma\client\runtime\library.js:121:7272)
    at handleAndLogRequestError (\node_modules\.bun\@[email protected]+e4e4c918d083d278\node_modules\@prisma\client\runtime\library.js:121:6593)
    at request (\node_modules\.bun\@[email protected]+e4e4c918d083d278\node_modules\@prisma\client\runtime\library.js:121:6300)
    at processTicksAndRejections (native:7:39) {
  code: 'P2022',
  meta: {
    modelName: 'Order',
    column: 'new'
  },
  clientVersion: '6.18.0'
}

Schema:

model Status {
  code   String  @id
  name   String  @unique
  orders Order[]
}

model Order {
  id            Int                   @id @default(autoincrement())
  clientEmail   String
  orderedAt     DateTime              @default(now())
  statusCode    String
  status        Status                @relation(fields: [statusCode], references: [code])
  shippingId    Int                   @unique
  shipping      Shipping              @relation(fields: [shippingId], references: [id])
  orderItems    OrderItem[]
}

Code with the problem:

 const order = await tx.order.create({
          data: {
            clientEmail,
            status: {
              connect: {
                code: "NEW"
              },
            },
            shipping: {
              create: shipping,
            },
            orderItems: {
              createMany: {
                data: orderItemCreateManyInput,
              },
            },
          },
        });

Database is in sync with the Prisma schema.

runic gladeBOT
#

You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.

hollow forge
#

When I change code to something other it is still the same error

#

Reinstalling node packages and removing generated folder does not help