I started with Symfony 4 and used the Security Components from the "Get Started" tutorial. Everythings went fine. I don't like Integer as ID, so switched to UUID as the ID if the Entity.
Entity schema:
/**
* @ORM\Id()
* @ORM\Column(type="guid")
* @ORM\GeneratedValue(strategy="UUID")
*/
private $id;
[...]
I did the updates till Symfony 5.2 and all components still work. My fault, I didn't saw the deprecated information about the changed UUID processes in a minor update... After updating thru composer to 5.2 nothing works. I get some 503 errors with the hints, that the old way of creating a UUID is not longer working.
So I changed the old, deprecated components... I change the PasswordEncoder to PasswordHasher... I change the old guid type style in the entities to
+ use Symfony\Component\Uid\Uuid;
/**
* @ORM\Id()
- * @ORM\Column(type="guid")
- * @ORM\GeneratedValue(strategy="UUID")
+ * @ORM\Column(type="uuid", unique=true)
*/
private $id;
[...]
+ public function __construct()
+ {
+ $this->id = Uuid::v4();
+ }
- public function getId(): string
+ public function getId(): Uuid
+ {
+ return $this->id;
+ }
I tested the new process on a new, clean project. I'm able to log in, create a user etc. The relations of to entities works fine etc.
BUT i can't migrate my old data to the new binary(16) field, without ForeignyKey errors, or data failures (plain cropped UUID String in a BLOB field).
Long story, short: I searched three days for a migration path for the old GUID fields char(36) to the new binary(16) UUID fields, without double all tables or scripting a CSV ex-/import. Find nothing and my head is too empty for new searchqueries ;) Is there a migrationpath for old projects to the new UUID component on existing data?