1

Say I want to rename property "user" to "customer". I understand that I can add @Uid of "user" at the new property name. Like:

@Uid(123985252953064306)
String customer;

So I presume during the next build and run of my app, "user" in the database is renamed to "customer". My first questions are: can I then remove @Uid(123985252953064306) from my code for further builds? I guess the answer is yes if the app is only used by myself? So to maintain compatibility for endusers of the app, I still need to keep the @Uid annotation in the code. Is it correct?

My next question is: what if later I want to rename "customer" to "client"? Should I add an additional @Uid at the new property? Like:

@Uid(123985252953064306)
@Uid(124568645726267383)
String client;

1 Answer 1

1

The questions you are asking are covered by the docs in Data Model Updates and with some more background in Meta Model, IDs, and UIDs.

In short, once you put an @Uid on an property (or an entity) you can rename it anyway you want as often you want. ObjectBox takes the UID to identify the property and knows it been there before. Thus you need to keep it on the property.

So from

@Uid(123985252953064306)
String customer;

you can go to

@Uid(123985252953064306)
String someFancyName;

and back to

@Uid(123985252953064306)
String customer;

with keeping the same data for the property in the database.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.