Suppose i have an application A which depends on mnesia with disk-enabled schema being present.
What i'd like to do is ensure that mnesia is running and allowing disc_copies
tables
from within A. I'm also considering the case where multiple applications need to access mnesia.
What would be the most portable (and standard) way to achieve this kind of thing, without hard coding mnesia startup and schema creation into the application callback module of A?
When developing interactively i simply do a
mnesia:create_schema([node()]).
within the Erlang shell to initialize an on-disk schema, then start the mnesia application with
mnesia:start().
and finally start the other ones that depend on a database being present.
I've found a solution myself. This is by no means the standard method, but it works.
Calling
mnesia:change_table_copy_type(schema, node(), disc_copies).
on application startup will ensure that the schema is disk-based while allowing mnesia to be started by a boot script. This blog entry was very helpful.