mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
fix: use resource's primary key config
This commit is contained in:
parent
b7ca80d2eb
commit
8cbad05f4a
1 changed files with 4 additions and 5 deletions
|
@ -9,14 +9,13 @@ defmodule Ash.Schema do
|
||||||
defmacro define_schema(name) do
|
defmacro define_schema(name) do
|
||||||
quote do
|
quote do
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
@primary_key {:id, :binary_id, autogenerate: true}
|
@primary_key false
|
||||||
@foreign_key_type :binary_id
|
|
||||||
|
|
||||||
schema unquote(name) do
|
schema unquote(name) do
|
||||||
for attribute <- @attributes do
|
for attribute <- @attributes do
|
||||||
unless attribute.name == :id do
|
field(attribute.name, Ash.Type.ecto_type(attribute.type),
|
||||||
field(attribute.name, Ash.Type.ecto_type(attribute.type))
|
primary_key: attribute.primary_key?
|
||||||
end
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
for relationship <- Enum.filter(@relationships, &(&1.type == :belongs_to)) do
|
for relationship <- Enum.filter(@relationships, &(&1.type == :belongs_to)) do
|
||||||
|
|
Loading…
Reference in a new issue