<div>Hi:</div>
<div>I can use transform_table to upgrade the table schema in mnesia.</div>
<div> </div>
<div>Eg.The version 1 of user record's defination is </div>
<div> </div>
<div>-record(user_v1,{uuid,name})</div>
<div> </div>
<div>I want to upgrade the user table to version 2</div>
<div> </div>
<div>-record(user_v2,{uuid,name,email}).</div>
<div> </div>
<div>I can use transform_table like this:</div>
<div> </div>
<div> transform_table(user,fun({user_v1,Uuid,Name})->#user_v2{uuid=Uuid,name=Name,email=""} end,record_info(fields,user_v2),user_v2).</div>
<div> </div>
<div>My question is </div>
<div>1. while the upgrade is in in progress, is the user record I read either the version 1 or the version 2 ?That is I can't be sure one user record's current version.</div>
<div>2. while the upgrade is in progress,will the modify of the old user record be lost?</div>
<div>3. If the 1 and 2 are true,how can I code two handle them? Shall I have to have two versions of process code to handle this situation ,like:</div>
<div>process_one_user(UserRecord)-></div>
<div> case of current_version(UserRecord) of</div>
<div> v1-> do something;</div>
<div> v2->do something</div>
<div> end</div>
<div>end</div>
<div> </div>
<div>Regards</div>
<div> </div>
<div> </div>