Created
February 13, 2009 00:49
-
-
Save seancribbs/62974 to your computer and use it in GitHub Desktop.
Erlang macro for automatically creating local mnesia tables for a record.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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