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

234
Vistas
How to select uuid version in entity typeorm?

I'm use typeorm and nestJs

I have an entity in which I am using the decorator @PrimaryGeneratedColumn('uuid') can I somehow specify a specific version of the uuid?

  @PrimaryGeneratedColumn('uuid')
  uuid: string;

can it be done like this?

  @PrimaryGeneratedColumn('uuid:4') #?
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

From here:

TypeORM uses RFC4122 compliant UUID v4 function for drivers which do not have a built-in uuid function

So depending on the driver, you're already getting V4 UUID's.

If you need a different UUID implementation, then you can use something like the following to manually set the ID. I've used this quite a lot for short ID's, and it works fine.

import { v4 as uuidv4 } from 'uuid';

  @PrimaryColumn()
  uuid: string = uuidv4()
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