andrew mmc andrewmmc@REDACTED
Wed Nov 25 14:07:21 CET 2009


I needed to change the structure of an mnesia table.  I followed the example
in the documentation:

-record(old, {key, val}).
-record(new, {key, val, extra}).

Transformer =
   fun(X) when record(X, old) ->
      #new{key = X#old.key,
           val = X#old.val,
           extra = 42}
{atomic, ok} = mnesia:transform_table(foo, Transformer,
                                      record_info(fields, new),

Substituting the record names and field mappings as per my
requirement. The transformation function works fine when I test it on
a record of the old type, outputting the new record ok.

However, now when I try to read from the new table, mnesia reports
no_exists, and the old table still exists but reads as empty...  Where
has my data gone?!

Any help much appreciated!



More information about the erlang-questions mailing list