ObjectDB ObjectDB

Schema evolution & renamed/moved enum

#1

Hello,

I have an entity with an attribute of type enum say com.pkg1.MyEnum. I created a few instances of the class with this attribute of type com.pkg1.MyEnum and stored them in the database.

Now, I moved that enum to a different package and renamed it say com.pkg2.MyNewEnum, which is not the new type of my attribute. When I open my database again, the attribute is null. I don't seem to be able to use the <schema> tag in the config file because my enum is not an entity.

What is a the proper way of handling the migration?

Thanks,

Farid 

edit
delete
#2

It seems that in this case automatic schema evolution is currently not supported.

If you have to update a field type into a non convertible type, you can add a new field (with a different field name) with the new type and on PostLoad convert the old field value to the new one.

ObjectDB Support
edit
delete
#3

Thanks, I guess I need to persist the changes after that?

edit
delete
#4

Yes, make the updates within an active transaction and commit.

ObjectDB Support
edit
delete
#5

Thanks.

Farid

edit
delete

Reply

To post on this website please sign in.