Maxim Sokhatsky 12 years ago
parent
commit
94b4bc0ce5
1 changed files with 16 additions and 13 deletions
  1. 16 13
      src/store_mnesia.erl

+ 16 - 13
src/store_mnesia.erl

@@ -29,6 +29,21 @@ distributed(Node) ->
                                || T <- mnesia:system_info(tables)]].
                                || T <- mnesia:system_info(tables)]].
 delete() -> mnesia:delete_schema([node()]).
 delete() -> mnesia:delete_schema([node()]).
 version() -> {version,"KVS MNESIA Embedded"}.
 version() -> {version,"KVS MNESIA Embedded"}.
+add_indexes() ->
+    add_table_index(comment, entry_id),
+    add_table_index(comment, author_id),
+    add_table_index(subscription, who),
+    add_table_index(subscription, whom),
+    add_table_index(group_subscription, who),
+    add_table_index(group_subscription, where),
+    add_table_index(entry, feed_id),
+    add_table_index(entry, entry_id),
+    add_table_index(entry, from),
+    add_table_index(user, facebook_id),
+    add_table_index(user, googleplus_id),
+    add_table_index(user, twitter_id),
+    add_table_index(user, email),
+    ok.
 initialize() ->
 initialize() ->
     error_logger:info_msg("Mnesia Init"),
     error_logger:info_msg("Mnesia Init"),
     mnesia:create_schema([node()]),
     mnesia:create_schema([node()]),
@@ -52,19 +67,7 @@ initialize() ->
     ?CREATE_TAB(transaction),
     ?CREATE_TAB(transaction),
     ?CREATE_TAB(translation),
     ?CREATE_TAB(translation),
     mnesia:wait_for_tables([comment,subscription,group,group_subscription,user,entry],5000),
     mnesia:wait_for_tables([comment,subscription,group,group_subscription,user,entry],5000),
-    add_table_index(comment, entry_id),
-    add_table_index(comment, author_id),
-    add_table_index(subscription, who),
-    add_table_index(subscription, whom),
-    add_table_index(group_subscription, who),
-    add_table_index(group_subscription, where),
-    add_table_index(entry, feed_id),
-    add_table_index(entry, entry_id),
-    add_table_index(entry, from),
-    add_table_index(user, facebook_id),
-    add_table_index(user, googleplus_id),
-    add_table_index(user, twitter_id),
-    add_table_index(user, email),
+    add_indexes(),
     ok.
     ok.
 
 
 dir() ->
 dir() ->