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
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
Hi,
is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
Hello,
I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these
buyer = %{
id: ...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
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 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
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217
Let’s say I have a map with required and optional k...
New
Other popular topics
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
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
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
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
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
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
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New







