Add a 'uuid' database schema type

Created on 7 October 2012, about 12 years ago
Updated 16 December 2023, about 1 year ago

Problem/Motivation

PostgreSQL provides a native uuid data type but Drupal does not allow using that for database schemas.

Proposed resolution

Provide a uuid schema field type for database schemas. This will translate to the native uuid data type for PostgreSQL and use a BINARY(36) field on MySQL and a simple blob field on SQLite.

Aside from test coverage the uuid schema field will not be used by any code as of yet, that will happen in follow-up issues, in particular #2491989: [PP-1] Use the 'uuid' database schema type (with native PostgreSQL implementation) for UUID fields . But it will already allow usage by custom and contrib modules so it makes sense to get this in separately as any respective changes to the entity system (even opt-in ones) will require a lot of discussion.

Remaining tasks

-

API changes

The database schema API provides a new uuid field type. Database drivers are expected to handle this by either utilizing a native UUID implementation or a simple string field, potentially with a length limit of 36.

Data model changes

Database schema array may contain fields of a new type uuid.

Original issue summary

Quoting @Berdir from #1642526-16: Add upgrade path from for generating UUIDs for all core entities :

PostgreSQL for example seems to have native support for that (http://www.postgresql.org/docs/9.1/static/datatype-uuid.html) and there's quite some discussion what exactly the best and fastest type for MySQL is.

Seeing suggestions such as BINARY(36), while you're currently using varchar(128), which I'm not sure why but that seems like a considerable overhead.

Feature request
Status

Needs work

Version

11.0 🔥

Component
Database 

Last updated 2 days ago

  • Maintained by
  • 🇳🇱Netherlands @daffie
Created by

🇩🇪Germany sun Karlsruhe

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024