mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
@ORM\GeneratedValue(strategy="UUID") documentation should suggest column types #5438
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tarjei on GitHub (Mar 2, 2017).
Originally assigned to: @Ocramius on GitHub.
Hi, it seems to me that the correct columntype for this datatype in mysql is
@ORM\Column(type="string", length="36")but if that is the case for all databases I do not know. Would it be possible to document what the correct datatype should be?I also found this interesting post[1] that suggests storing uuids as a binary field. Have you considered supporting that?
Kind regards,
Tarjei
@Ocramius commented on GitHub (Mar 2, 2017):
CHAR(36)is mostly inefficient, since a UUID is just a 128 bit integer. Please refer to https://github.com/ramsey/uuid-doctrine for further guidance@tarjei commented on GitHub (Mar 2, 2017):
Ok, so the UUID method in native doctrine should not be used?
Regards
@Ocramius commented on GitHub (Mar 2, 2017):
The generator strategy can be used, but it makes little sense, since UUIDs are designed so that they can be generated before DB persistence
@fabwu commented on GitHub (Oct 18, 2017):
@Ocramius I would like to change my primary keys to UUID but I'm not quite sure which doctrine type I should use. This library stores the UUID as well as
CHAR(36)so I'm a bit confused.Could you provide an example how you use UUID as primary keys in your entities?
@AlessandroMinoccheri commented on GitHub (Oct 18, 2017):
Last time @wuethrich44 I have used this code:
@Ocramius commented on GitHub (Oct 18, 2017):
You'd probably use the UUIDBinaryType
On 18 Oct 2017 11:56, "Fabian Wüthrich" notifications@github.com wrote: