<div dir="ltr">I have an escript that I can run to update the data in an existing mnesia table:<div><br></div><div>
<p class="">#!/usr/bin/env escript</p>
<p class="">%% -*- erlang -*-</p>
<p class=""><br></p>
<p class="">-include("record_defs.hrl").</p>
<p class=""><br></p>
<p class="">main([NodeIn|_]) -></p>
<p class=""> Node = list_to_atom(NodeIn),</p>
<p class=""> ok = migrate_record_schema(Node),</p>
<p class=""> halt().</p>
<p class=""><br></p>
<p class=""><br></p>
<p class="">migrate_record_schema(Node) -></p>
<p class=""> MigrationFun = fun({</p>
<p class=""> old_record,</p>
<p class=""> Id,</p>
<p class=""> Name,</p>
<p class=""> DateCreated,</p>
<p class=""> DateDeactivated,</p>
<p class=""> Password,</p>
<p class=""> Url</p>
<p class=""> }) -></p>
<p class=""> {</p>
<p class=""> new_record,</p>
<p class=""> Id,</p>
<p class=""> Name,</p>
<p class=""> DateCreated,</p>
<p class=""> DateDeactivated,</p>
<p class=""> Password,</p>
<p class=""> Url,</p>
<p class=""> false</p>
<p class=""> }</p>
<p class=""> end,</p>
<p class=""> {atomic, ok} = rpc:call(Node, mnesia, transform_table, [old_record, MigrationFun, record_info(fields, new_record)]),</p>
<p class=""> ok.</p><div>The problem I have is that when I deploy the code that uses this new record schema and update the schema, this new transformed data gets replicated to the other clustered nodes as well.</div><div>
<br></div><div>So, what I was hoping to do was create a new table say new_record, that I place the transformed records into. The new code will reference that table. The yet-to-be-upgraded nodes will still continue to reference the old schema until they get the new code deployed.</div>
<div><br></div><div>Is this possible without jumping through major hoops? Or, maybe I'm missing a simpler solution?</div><div><br></div><div>Any help would be greatly appreciated.</div><div><br></div><div><br></div></div>
</div>