[erlang-questions] How to control a table version in Mnesia?

Shapovalov Taras shapovalovts@REDACTED
Wed Oct 15 08:24:32 CEST 2014


Thank you, Dmitry for the idea, this solves my problem.

Best regards,

Taras

On Tue, Oct 14, 2014 at 1:48 PM, Dmitry Kolesnikov <dmkolesnikov@REDACTED>
wrote:

> Hello,
>
> Indeed auto-increments is use-full.
>
> You can subscribe to schema table events:
> mnesia:subscribe({table, schema, detailed}).
>
> It gives you ability to trace changes and manipulate you custom version.
>
> Best Regards,
> Dmitry
>
> On 14 Oct 2014, at 11:12, Shapovalov Taras <shapovalovts@REDACTED> wrote:
>
> Thank you, Dmitry,
>
> The disadvantage of user_properties in my case is it is not
> auto-incremented by Mnesia upon table definition change (this feature would
> be useful for me).
>
> Best regards,
>
> Taras
>
> On Tue, Oct 14, 2014 at 11:10 AM, Dmitry Kolesnikov <
> dmkolesnikov@REDACTED> wrote:
>
>> Hello,
>>
>> You can use user_properties features of amnesia tables if you need some
>> version for accounting.
>>
>> mnesia:create_table(myt, [{user_properties, [{vsn, 1}]}]).
>> amnesia:table_info(myt, user_properties).
>> [{vsn,1}]
>>
>>
>> - Dmitry
>>
>> On 14 Oct 2014, at 09:33, Shapovalov Taras <shapovalovts@REDACTED>
>> wrote:
>>
>> > Hi guys,
>> >
>> > Do you know if there is a safe way to increment a table version (in
>> Mnesia schema) with some value (>1) or just set its value into a particular
>> version? In my case Mnesia runs only in a local mode (and will never be
>> distributed) and as far as I understand the version is not really used in
>> the local mode, so I would like to utilize it for my purposes.
>> >
>> > By some reason mnesia_lib:set() does not really work for me. In fact
>> after I call that function and then request the table version, it seems it
>> is changed, but ets:tab2list(schema) shows that it did not (and after I
>> restart Mnesia, the requested version returns to the old value).
>> >
>> > Best regards,
>> >
>> > Taras
>> > _______________________________________________
>> > erlang-questions mailing list
>> > erlang-questions@REDACTED
>> > http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
>
> --
> /T
>
>
>


-- 
/T
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141015/92243189/attachment.htm>


More information about the erlang-questions mailing list