Skip to content

Commit 8d65762

Browse files
Fix autogenerated uuid pk syntax (#4695)
1 parent 016eefa commit 8d65762

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/ecto/schema.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ defmodule Ecto.Schema do
15961596
section for more info). Primary keys are automatically set up for embedded
15971597
schemas as well, defaulting to `{:id, :binary_id, autogenerate: true}`.
15981598
This will generate the default UUID v4. You can use UUID v7 instead by setting
1599-
the primary key to `{:id, :binary_id, autogenerate: [version: 7]}`
1599+
the primary key to `{:id, Ecto.UUID, autogenerate: [version: 7]}`
16001600
Note `:primary_key`s are not automatically read back on `insert/2`,
16011601
unless one of `autogenerate: true` or `read_after_writes: true` is set.
16021602

lib/ecto/uuid.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ defmodule Ecto.UUID do
1414
To use UUID v7 (time-ordered) instead:
1515
1616
use Ecto.Schema
17-
@primary_key {:id, :binary_id, autogenerate: [version: 7]}
17+
@primary_key {:id, Ecto.UUID, autogenerate: [version: 7]}
1818
1919
To use UUID v7 (time-ordered) monotonic:
2020
2121
use Ecto.Schema
22-
@primary_key {:id, :binary_id, autogenerate: [version: 7, monotonic: true]}
22+
@primary_key {:id, Ecto.UUID, autogenerate: [version: 7, monotonic: true]}
2323
2424
According to [RFC 9562](https://www.rfc-editor.org/rfc/rfc9562#name-monotonicity-and-counters):
2525
"Monotonicity (each subsequent value being greater than the last) is the

0 commit comments

Comments
 (0)