Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!