Skip to content

Commit 83676dd

Browse files
committed
Clarify more primary key behaviour, closes #4616
1 parent 523776f commit 83676dd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/ecto/schema.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,8 +1588,10 @@ defmodule Ecto.Schema do
15881588
15891589
* `:primary_key` - The `:primary_key` option can be used with the same arguments
15901590
as `@primary_key` (see the [Schema attributes](#module-schema-attributes)
1591-
section for more info). Primary keys are automatically set up for embedded schemas as well,
1592-
defaulting to `{:id, :binary_id, autogenerate: true}`.
1591+
section for more info). Primary keys are automatically set up for embedded
1592+
schemas as well, defaulting to `{:id, :binary_id, autogenerate: true}`.
1593+
Note `:primary_key`s are not automatically read back on `insert/2`,
1594+
unless one of `autogenerate: true` or `read_after_writes: true` is set.
15931595
15941596
* `:on_replace` - The action taken on associations when the embed is
15951597
replaced when casting or manipulating parent changeset. May be

0 commit comments

Comments
 (0)