I created an mnesia database with:-
mix amnesia.create -d Database --disk
and with table schema defined in database.ex
After some tests, I want to add more tables to the same database. Can anybody tell me how to do this?
Thanks in advance.
I created an mnesia database with:-
mix amnesia.create -d Database --disk
and with table schema defined in database.ex
After some tests, I want to add more tables to the same database. Can anybody tell me how to do this?
Thanks in advance.
Never used amneisa but looking at docs you probably created a file disk.ex
I suppose.
https://hexdocs.pm/amnesia/Amnesia.Table.html#create/2
use Amnesia
defdatabase Foo do
deftable Bar, [:id, :a], type: :bag
deftable Baz, [:id, :a, :b] do
def foo(self)
42
end
end
end
So in that file you need to add deftable
.
Thank you for the reply. I cant add another deftable since the DB already exist.
23:32:11.820 [notice] Application mnesia exited: :stopped
** (Amnesia.TableExistsError) Table Database already exists
(amnesia 0.2.8) lib/amnesia/table.ex:138: Amnesia.Table.create!/2
(test_app 0.1.0) lib/database.ex:18: Database.create!/1
(amnesia 0.2.8) lib/mix/amnesia.create.ex:19: Mix.Tasks.Amnesia.Create.run/1
(mix 1.14.0) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
(mix 1.14.0) lib/mix/cli.ex:84: Mix.CLI.run_task/2