Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

275
Vistas
Prisma Migrating issue with Mongo schema and Enums

So I´ve made this schema in first instance

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

model User {

  id        String      @id @default(auto()) @map("_id") @db.ObjectId
  email     String      @unique
  role      TipoFichaje @default(JORNADA_ENTRADA)
  createdAt DateTime    @db.Date

}

model Entity {

  id        String   @id @default(auto()) @map("_id") @db.ObjectId
  name      String
  createdAt DateTime @db.Date

}

enum TipoFichaje {
  JORNADA_ENTRADA
  JORNADA_SALIDA
  DESAYUNO
  COMIDA
  FORMACION
  FORMACION3
}

Well then I push the db (prisma db push --preview-feature) and after that I Inserted an object like this:

{
  email: "email@gmail.com"
  role:"FORMACION3"
  createdAt:1970-01-01T00:00:00.000+00:00
}

After that I remove the "Formacion3" ENUM from TipoFichaje and push again (prisma db push)

Like this:

enum TipoFichaje {
      JORNADA_ENTRADA
      JORNADA_SALIDA
      DESAYUNO
      COMIDA
      FORMACION
}

When I try to get the data with Prisma Studio throws this error:

Message: Error in Prisma Client request: 


Invalid `prisma.user.findMany()` invocation:


  Value 'FORMACION3' not found in enum 'TipoFichaje'
  
Query:
{
  "modelName": "User",
  "operation": "findMany",
  "args": {
    "take": 100,
    "skip": 0,
    "select": {
      "id": true,
      "email": true,
      "role": true,
      "createdAt": true
    }
  }
}

My question is: Is it a normal behavior? I mean If i migrate the db with the new changes shouldn't migration fix this? How can I fix this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

So, solution came by Janpio (Head of Engineering @ Prisma)

Here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda