From 8cbad05f4ae9c9bd55b89588a10fdbf1754e70ef Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Thu, 30 Apr 2020 20:16:58 -0400 Subject: [PATCH] fix: use resource's primary key config --- lib/ash/resource/schema.ex | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ash/resource/schema.ex b/lib/ash/resource/schema.ex index 8a317970..c74462de 100644 --- a/lib/ash/resource/schema.ex +++ b/lib/ash/resource/schema.ex @@ -9,14 +9,13 @@ defmodule Ash.Schema do defmacro define_schema(name) do quote do use Ecto.Schema - @primary_key {:id, :binary_id, autogenerate: true} - @foreign_key_type :binary_id + @primary_key false schema unquote(name) do for attribute <- @attributes do - unless attribute.name == :id do - field(attribute.name, Ash.Type.ecto_type(attribute.type)) - end + field(attribute.name, Ash.Type.ecto_type(attribute.type), + primary_key: attribute.primary_key? + ) end for relationship <- Enum.filter(@relationships, &(&1.type == :belongs_to)) do