私はアプリケーションを持っており、登録ユーザーのデータを保存するChicagoBoss
ために使用したいと考えています。mnesia
でセットアップ{db_adapter, mnesia}
しましたboss.config
。今、mnesia データベースとテーブルを作成しようとしています。
mnesia:stop(),
mnesia:create_schema([node()]),
mnesia:change_table_copy_type(schema, node(), disc_copies),
ok = mnesia:start(),
ExistingTables = mnesia:system_info(tables),
TablesToCreate = (?MODELS ++ ['_ids_']) -- ExistingTables,
lists:foreach(fun(T) ->
case T of
'_ids_' ->
{atomic, ok} = mnesia:create_table('_ids_', [{attributes, [type, id]}, {disc_copies, node()}]);
_ ->
% get model record
ModelRecord = boss_record_lib:dummy_record(lists:nth(1, ?MODELS)),
% get model attributes
Attributes = ModelRecord:attribute_names(),
% setup mnesia tables
{atomic, ok} = mnesia:create_table(lists:nth(1, ?MODELS), [{attributes, Attributes}, {disc_copies, Node}])
end
end,
TablesToCreate),
しかし、テーブル作成の両方のバリアントでクラッシュします:
{aborted,{bad_type,my_model, {disc_copies,nonode@nohost}}}
ありがとうございました。