Ash FrameworkAF
Ash Framework3y ago
3 replies
rohan

Resources without primary key not supported

I have this code:
defmodule Scribble.EmailHandler.User do
  use Ash.Resource
  use Ash.Resource, data_layer: Ash.DataLayer.Ets

  actions do
    defaults [:create, :read]
  end

  attributes do
    uuid_primary_key :id

    attribute :email, :string, allow_nil?: false
    attribute :name, :string, allow_nil?: false
    attribute :reply_email, :string
    create_timestamp :inserted_at
    update_timestamp :updated_at
  end

  calculations do
    calculate :response_email, :string, expr(reply_email || email)
  end
end

And since adding the data layer I'm getting "Resources without a primary key are not supported"

But I have the uuid_primary_key. Am I doing something wrong?
Was this page helpful?