I want to create an mnesia schema and table in my code after the system starts, so I need to detect weather the mnesia schema and table have been created. If not, I want to create them. Is this a good idea? And how can I detect the mnesia schema and table?
One way to handle this is -
Try creating table using mnesia:create_table(Table_name, ...)
If the table already exists (1) would return {aborted,
{already_exists, Table_name}}
If table doesn't exit, it will be created and {atomic,ok}
will be
returned if successful
If there is any error in table creation in (3), {aborted, Reason}
will be returned.
Handle each of these return values as required.