Skip to content

Support UUIDs in ORM #619

Open
@brendt

Description

@brendt

In case we need to convert from UUID to binary (MySQL and SQLite), the easiest way to do it would be in PHP:

  • That way we don't have to worry about special inserts per database-dialect.
  • Selecting should be done using the binary format of the UUID, so we'd have to convert it before building the select query
  • The CreateTableStatement and AlterTableStatement should simply have a uuid() method that creates the field with a unique index
  • We might have an option to store the "human readable" version in the database as well

An example of how this was done with a Laravel package (before Laravel had support for it): https://github.com/spatie/laravel-binary-uuid/tree/master

Having thought it through, I think we're in the clear about breaking changes, and can move this to post-1.0

Activity

added this to the pre-1.0 milestone on Nov 23, 2024
added theissue type on Mar 8, 2025
iamdadmin

iamdadmin commented on May 17, 2025

@iamdadmin

Just adding, it would be good if the UUID supported was specifically UUIDv7 so it's sortable https://uuid7.com - coming from Laravel I've been using ULID for the advantages, but UUIDv7 makes ULID unnecessary and obviously there's wider support then.

modified the milestones: post-1.0, 1.1 on Jun 27, 2025

1 remaining item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Support UUIDs in ORM · Issue #619 · tempestphp/tempest-framework