Mnesia directory is not created when running iex -S mix and shows: Mnesia.nonode@nohost" is NOT used

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.

  1. 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.
  2. 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_applications instead of extra_applications and start it manually after schema is created.
  3. Check if schema exists and if not change the in memory schema to :disc_copies using :mnesia.change_table_copy_type/3

#1 would be the most robust I would say.