I have an OTP application 'myapp' which depends on mnesia. Where should I put the call to mnesia:create_schema/1?
If I add the dependency to {applications,[]} in myapp.app.src, mnesia starts first and I can't call create_schema in myapp:start/2. It might make sense to call it in myapp.script/myapp.boot, but relx doesn't let me add anything to that.
I don't want to make mnesia an included application.
EDIT: I've found a workaround by listing mnesia in the applications in the relx config, but running mnesia:create_schema([node()]), application:ensure_all_started(mnesia, permanent) in myapp:start/2. Is there a better way?
I had this problem too. You should include
{mnesia, load}in relx app list, create schema instart/2callback of your application and start mnesia. It's good to write{mnesia, [{dir, "YourMnesiaDBPath"}]}insys.configtoo.