[英]Realm migration android
i'm making a migration for my realm database Android, this is the code: 我正在为我的领域数据库Android进行迁移,这是代码:
if (oldVersion == 3) {
schema.create("ContactLists")
.addField("id", String.class)
.addPrimaryKey("id")
.addField("name", String.class)
.addField("image", Byte.class);
oldVersion++;
}
The problem is that image field it'a a byte array, this is the model: 问题是图像字段是一个字节数组,这是模型:
@PrimaryKey
private String id;
private String name;
private byte[] image;
But i think that Byte.class is not correct for byte[] array, any ideas? 但是我认为Byte.class对于byte []数组是不正确的,有什么想法吗?
尝试这个:
addField("image", byte[].class)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.