I’m playing around with the Mnesia datalayer while I’m going through the Ash book. I wanted to give it a go instead of the postgresql datalayer. I’m setting an explicit table name (:artists
), but it still wants to use the module name as the table. Am I configuring it wrong? Here’s my resource module:
defmodule AshMnesia.Music.Artist do
use Ash.Resource,
otp_app: :ash_mnesia,
domain: AshMnesia.Music,
data_layer: Ash.DataLayer.Mnesia
mnesia do
table :artists
end
actions do
defaults [:read, :destroy]
create :create do
accept [:name]
end
update :update do
accept [:name]
end
end
attributes do
uuid_v7_primary_key :id
attribute :name, :string do
allow_nil? false
end
end
end
Even though I’m explicitly specifying a table, the below still is using an mnesia table called AshMnesia.Music.Artist
.
> AshMnesia.Music.Artist |> Ash.Changeset.for_create(:create, %{name: "Daisy Jones"}) |> Ash.create
Thanks for any help anyone can give.