Skip to content

Commit 1945476

Browse files
authored
use Postgres built-in uuid 4 function (#1323)
1 parent 748d802 commit 1945476

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

piccolo/columns/defaults/uuid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UUID4(Default):
1717

1818
@property
1919
def postgres(self):
20-
return "uuid_generate_v4()"
20+
return "gen_random_uuid()"
2121

2222
@property
2323
def cockroach(self):

piccolo/engine/postgres.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ class PostgresEngine(Engine[PostgresTransaction]):
354354
def __init__(
355355
self,
356356
config: dict[str, Any],
357-
extensions: Sequence[str] = ("uuid-ossp",),
357+
extensions: Sequence[str] = tuple(),
358358
log_queries: bool = False,
359359
log_responses: bool = False,
360360
extra_nodes: Optional[Mapping[str, PostgresEngine]] = None,

tests/apps/migrations/auto/integration/test_migrations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def test_uuid_column(self):
437437
[
438438
x.data_type == "uuid",
439439
x.is_nullable == "NO",
440-
x.column_default == "uuid_generate_v4()",
440+
x.column_default == "gen_random_uuid()",
441441
]
442442
),
443443
)

0 commit comments

Comments
 (0)