shahryarjb
Mnesia has no access to create table in disc macOs dev mode
Hello, I have read many posts about disc problem in the forum, but I have still this problem:
I have no problem to create ram copy
{:create_table,
{:aborted, {:bad_type, MishkaAuth.User.Users, :disc_copies, :nonode@nohost}}}}
I did this comment before creating a post:
my config file:
config :mnesia, dir: "/Users/shahryar/Desktop/D-Access/mnesia_db"
# drwxr-xr-x 3 shahryar staff 96 Mar 22 15:04 mnesia_db
My fields and mnesia name:
@mnesia_tab __MODULE__
@mnesia_tab_fields [
:id,
:full_name,
:username,
:email,
:mobile,
:password_hash,
:unconfirmed_email,
:unconfirmed_mobile,
:roles,
:scopes,
:devices,
:status,
:inserted_at,
:updated_at
]
And the function I create a disc_copies table
def start_mnesia() do
:mnesia.stop()
:mnesia.create_schema()
|> IO.inspect(label: "Mnesia schema start of user ====>")
:mnesia.start(:app)
|> IO.inspect(label: "Application start of user ====>")
case :mnesia.create_table(@mnesia_tab,
type: :set,
disc_copies: [Node.self()],
attributes: @mnesia_tab_fields,
index: [:username, :email, :mobile],
record_name: @mnesia_tab,
storage_properties: [ets: [{:read_concurrency, true}, {:write_concurrency, true}]]
) do
{:atomic, :ok} -> :ok
{:aborted, {:already_exists, @mnesia_tab}} -> :ok
any -> {:error, {:create_table, any}}
end
|> IO.inspect(label: "Creating table ---->")
:mnesia.wait_for_tables([@mnesia_tab], :timer.seconds(15))
|> IO.inspect(label: "Mnesia wait for tables start of user ====>")
end
I am using mac os and dev mode with iex -S mix phx.server
Please help me to fix this issue, 3 or 4 years ago I fixed it, but I can not remember now ![]()
Thank you in advance
Most Liked
rvirding
Creator of Erlang
![]()
Yes, Mnesia is an old Erlang tool and in Erlang strings are charlists. That’s the way it is.
2
shahryarjb
I remove my custom path and it works, but I dont know why i can not set a dir for mnesia
for example if i set a path:
Application.put_env(:mnesia, :dir, "/Users/shahryar/Desktop/D-Access/mnesia_db")
or
:mnesia.stop()
Application.put_env(:mnesia, :dir, "/Users/shahryar/Desktop/D-Access/mnesia_db")
after that call
:mnesia..create_schema([node()])
It returns {:error, {:EXIT, :function_clause}}
I do not know why
Update
use this
![]()
Application.put_env(:mnesia, :dir, mnesia_dir |> to_charlist)
1
Popular in Questions
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it.
I’m very interested in Elixir,...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
I have a super simple question about elixir - how would I take a file like this
foo bar baz
and output a new file that enumerates th...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Other popular topics
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New







