This is incorrect from your post:
... mnesiashould be included in the application resource file in key applications, so if myapp is running, mnesia will start automatically.
Applications that you write as a value applicationsin a file .appdo not start automatically, but it says that they must be running before your application starts.
Imagine that we want to create an application foothat depends on mnesiawith some customization. One way is to run it in a file foo_app.erl:
-module(foo_app).
-behaviour(application).
-export([start/2, stop/1]).
start(_Type, _Args) ->
mnesia:start().
mnesia:change_table_copy_type(schema, node(), disc_copies),
%% configure mnesia
%% create your tables
%% ...
foo_sup:start_link().
stop(_State) ->
ok.
Thus, he creates a scheme disc, whether it was created before or not.
. , mnesia applications foo.app.src ( foo.app), foo {error, {not_started, mnesia}}. , foo_app:start/2.