Commit 692cd67f authored by Leonardo Aramaki's avatar Leonardo Aramaki

Implement migration for database version 6 with added field on RealmUser

parent 6f10ec41
......@@ -6,6 +6,7 @@ import chat.rocket.persistence.realm.models.ddp.RealmRole;
import chat.rocket.persistence.realm.models.ddp.RealmRoomRole;
import chat.rocket.persistence.realm.models.ddp.RealmSpotlightRoom;
import chat.rocket.persistence.realm.models.ddp.RealmSpotlightUser;
import chat.rocket.persistence.realm.models.ddp.RealmUser;
import io.realm.DynamicRealm;
import io.realm.FieldAttribute;
import io.realm.RealmMigration;
......@@ -67,6 +68,13 @@ public class Migration implements RealmMigration {
if (oldVersion == 4) {
RealmObjectSchema messageSchema = schema.get("RealmMessage");
messageSchema.addField(RealmMessage.EDITED_AT, long.class);
oldVersion++;
}
if (oldVersion == 5) {
RealmObjectSchema userSchema = schema.get("RealmUser");
userSchema.addField(RealmUser.NAME, String.class);
}
}
......
......@@ -15,7 +15,7 @@ public class RealmStore {
.name(name + ".realm")
.modules(new RocketChatLibraryModule())
.migration(new Migration())
.schemaVersion(5)
.schemaVersion(6)
// Just in case
.deleteRealmIfMigrationNeeded()
.build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment