-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Django CoreThis idea is suitable for inclusion in Django itselfThis idea is suitable for inclusion in Django itselfModels/ORM
Description
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
uuidv4anduuidv7from version 18.
Postgres also has gen_random_uuid which creates a uuid4 and we currently use in django.contrib.postgres.functions.RandonUUID.
MariaDB
Oracle
uuidis 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
knyghty, LilyFirefly, UnknownPlatypus, DmytroLitvinov, shangxiao and 7 more
Metadata
Metadata
Assignees
Labels
Django CoreThis idea is suitable for inclusion in Django itselfThis idea is suitable for inclusion in Django itselfModels/ORM
Type
Projects
Status
In progress