[erlang-questions] Initializing mnesia

T Ty <>
Fri Oct 9 11:45:34 CEST 2015

It boils down to what presuppositions you want your application to have. I
prefer splitting initialization of the working environment from starting
the application.

Meaning when starting my application I assume mnesia tables have been
created and I don't have to try to be clever in my application code. If the
tables aren't there application doesn't start.

Since your application is being started via some shell or init script place
testing for preconditions and creation of mnesia tables there instead.

In the application you might want do to mnesia:wait_for_tables/2 and
ultimately: If the tables aren't there application doesn't start.

ok = mnesia:wait_for_tables([session], 5000)

On Fri, Oct 9, 2015 at 9:43 AM, zxq9 <> wrote:

> On Friday 09 October 2015 09:39:01 Graham Hay wrote:
> > There was another discussion here
> > (
> http://erlang.2086793.n4.nabble.com/Mnesia-create-tables-best-practices-td4710757.html
> ),
> > about including an initialised db in a release.
> The non-annoying link:
> http://erlang.org/pipermail/erlang-questions/2015-February/083160.html
> _______________________________________________
> erlang-questions mailing list
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151009/0db64b62/attachment.html>

More information about the erlang-questions mailing list