From 35f2273275e2ba85d9e0e6b9b2ec82b2e16cb030 Mon Sep 17 00:00:00 2001 From: Christoph Kappestein Date: Sat, 3 Aug 2024 11:36:04 +0200 Subject: [PATCH] use uuid v7 only if supported --- src/Action/SqlActionAbstract.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Action/SqlActionAbstract.php b/src/Action/SqlActionAbstract.php index a51bc7a..80387c2 100644 --- a/src/Action/SqlActionAbstract.php +++ b/src/Action/SqlActionAbstract.php @@ -105,7 +105,11 @@ protected function getData(RecordInterface $body, Connection $connection, Table } if ($insert && $column->getName() === $primaryKey && $column->getType() instanceof GuidType && $value === null) { - $value = Uuid::v7()->toString(); + if (method_exists(Uuid::class, 'v7')) { + $value = Uuid::v7()->toString(); + } else { + $value = Uuid::v4()->toString(); + } } if ($value === null && $column->getNotnull()) {