Skip to content

Support UUID4 and UUID7 on multiple databases #85

@LilyFirefly

Description

@LilyFirefly

Code of Conduct

  • I agree to follow Django's Code of Conduct

Feature Description

Introduce UUID4 and UUID7 database functions to allow use with db_default on multiple databases.

Problem

With the introduction of uuid version 7, Django users may wish to migrate to using version 7 as a db_default for model primary keys and other UUIDField instances.

Request or proposal

proposal

Additional Details

Uuid v4 and v7 are now available on multiple databases:

Postgres

Postgres also has gen_random_uuid which creates a uuid4 and we currently use in django.contrib.postgres.functions.RandonUUID.

MariaDB

Oracle

  • uuid is a uuid v4 introduced in version 23ai.

Version 7 isn't supported yet.

Sqlite

Uuid v4 is available via an extension, but this is probably too difficult to support.

MySQL

Not yet supported. (There is a uuid function, but this creates v1 uuids.)

Implementation Suggestions

No response

Metadata

Metadata

Assignees

Labels

Django CoreThis idea is suitable for inclusion in Django itselfModels/ORM

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions