create_schema must be called when mnesia is stopped. By adding mnesia to extra applications it is started automatically. When that happens it will create an in-memory schema.
Some alternatives.
- create the mnesia schema before you start the application (create schema is a one-time operation so it could be done in a task like normal SQL schema migration.
- Check if the schema exist and if not stop mnesia, create the schema and start it as part of some startup logic. or perhaps add it to
included_applicationsinstead ofextra_applicationsand start it manually after schema is created. - Check if schema exists and if not change the in memory schema to
:disc_copiesusing:mnesia.change_table_copy_type/3
#1 would be the most robust I would say.






















