I have a mnesia table that I am trying to delete. However, when I try to run :mnesia.delete(TableName)
I get this error back {:aborted, {:no_exists, TableName}}
When I try to create the same table by running :mnesia.create_table(TableName, [attributes: [:id, :att1, :att2], disc_copies: [Node.self()]])
I get this back {:aborted, {:already_exists, TableName}}
I can still see the .DCD
file for the table after a delete, what causes this and how can I fix it?
Note: The code is in an Elixir codebase.
Edit: When my application starts, I try to delete and recreate that table, even if it exists.
:mnesia.delete/1
looks for a key to delete in the given table (and takes a tuple {Table, Key}
).
You probably want :mnesia.delete_table/1
which will delete the table itself.
Docs for more: http://erlang.org/doc/man/mnesia.html#delete_table-1