-module(timestamper_dev).
-export([start/0, create_tables/1]).

start() ->
    ok = application:load(mnesia),
    ok = application:set_env(mnesia, dir, "/home/jdbernard/projects/jdb-labs/timestamper/web-app/db/test"),
    ok = mnesia:start(),
    error_logger:info_report("TimeStamper app started."),
    ok.

create_tables(Nodes) ->
    TableOpts = [{disc_copies, Nodes}],
    {atomic, ok} = id_counter:create_table(TableOpts),
    {atomic, ok} = ts_user:create_table(TableOpts),
    {atomic, ok} = ts_timeline:create_table(TableOpts),
    {atomic, ok} = ts_entry:create_table(TableOpts),
    {atomic, ok} = ts_ext_data:create_table(TableOpts),
    ok.
