Ash.DataLayer.Mnesia - table name

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. :folded_hands:

Fixed in main of ash. With a commit aptly entitled

fix: actually use the mnesia table configured :man_facepalming:

1 Like

Thanks @zachdaniel! I just started digging into the code and cloned the repo to fix it and noticed you already did :laughing:

Much appreciated!