Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#11571·typeorm

uuid_generate_v4 function for postgres migration

Author: viicoCreated Jul 16, 2025Updated Sep 23, 2026
Labelsbug

Issue description

We use typeorm-ts-node-commonjs to generate our postgres migrations. We have an uuid primary key and we use the PrimaryGeneratedColumn decorator, like this : @PrimaryGeneratedColumn("uuid"). The generated migrations use uuid_generate_v4 function which needs the uuid-ossp extension.

Expected Behavior

Use the native gen_random_uuid() postgres function as default value for uuid primary key. We don't want to install extension only to manage this uuid generation.

Actual Behavior

The actual function used is uuid_generate_v4(), this function needs the uuid-ossp extension.

Steps to reproduce

Generate migration with an entity containing an uuid as primary key (typeorm-ts-node-commonjs migration:generate).

typescript
@Entity()
export class Application {
    @PrimaryGeneratedColumn("uuid")
    id: string;
}

My Environment

Dependency Version
Operating System Windows 11
Node.js version 22.17.1
Typescript version 5.8.3
TypeORM version 0.3.22

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Source: typeorm/typeorm

View original on GitHubView discussion on GitHub