Home Help Center

custom migration

wangbaochuanwangbaochuan Member Paul WangOrganization: Trade BlazerProject: A future tool

I have some problem in transform string type to enum.
my original type define a string type "type" and I change the type to enum type in new ice definition.
When I run transformdb and it show me following warning
"warning in <database> descriptor, line 4: unable to convert ::IIceTest::ITest member type value 'type1' from string to ::IIceTest::TypeEnum"

Can some one to help?
thank you!

My data:
id type
1 "type1"
2 "type2"
3 "unknow"

old ice:
module IIceTest
struct ITest
int id;
string type;
sequence<ITest> ITests;

slice2freeze --dict TestMap,int,::IIceTest::ITest TestMap TestMap.ice

new ice: (use enum TypeEnum instead to string for member type)
module IIceTest
enum TypeEnum
struct ITest
int id;
TypeEnum type;
sequence<ITest> ITests;

<database key="int" value="::IIceTest::ITest">
<if test="oldvalue.type != 'type1'">
<set target="newvalue.type" value="::New::TYPE2"/>

<!-- struct ::IIceTest::ITest -->
<transform type="::IIceTest::ITest"></transform>

<!-- sequence ::IIceTest::ITests -->
<transform type="::IIceTest::ITests"></transform>

<!-- enum ::IIceTest::TypeEnum -->
<init type="::IIceTest::TypeEnum"></init>
transform --old TestMap.ice --new NewTestMap.ice -f transform.xml testdb testfile newtestdb


  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff

    These warnings are normal and do not indicate that the transformation failed. They are emitted during transformdb's automatic migration phase to alert you to the fact that it was unable to perform a particular conversion. You can ignore the warnings because your custom migration script is converting the field. (If you were relying solely on automatic migration, these warnings indicate that additional modifications of the new database might be necessary.)

    Have you examined the new database with dumpdb? If not, you should try it; I expect you'll find that the new database looks exactly as you intended.

  • wangbaochuanwangbaochuan Member Paul WangOrganization: Trade BlazerProject: A future tool
    Ohh, yes, the data is correct.
    Thank you, Mark.

    Best Regard!
Sign In or Register to comment.