Skip to content

Instantly share code, notes, and snippets.

@seancribbs
Created February 13, 2009 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seancribbs/62974 to your computer and use it in GitHub Desktop.
Save seancribbs/62974 to your computer and use it in GitHub Desktop.
Erlang macro for automatically creating local mnesia tables for a record.
% Damn record_info compilation
-define(create_table(RecordName),(fun() ->
try
mnesia:table_info(type, RecordName)
catch
exit:_ ->
mnesia:create_table(RecordName, [{attributes, record_info(fields, RecordName)},
{type, ordered_set},
{disc_copies, [node()]}])
end
end)()).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment