在Android项目中升级领域

在Android项目中升级领域,第1张

概述我目前在我的一个Android项目中运行RealmVersion0.82.0.我没有触及Realm很长一段时间,直到我最近注意到它们在此期间上升到版本2.0.2.我想升级我的Realm版本,不幸的是,我不知道从我的旧版本升级到当前版本是否会起作用或破坏我的代码.我特别关注迁移,因为自我的代码以来迁移API

我目前在我的一个Android项目中运行Realm Version 0.82.0.我没有触及Realm很长一段时间,直到我最近注意到它们在此期间上升到版本2.0.2.我想升级我的Realm版本,不幸的是,我不知道从我的旧版本升级到当前版本是否会起作用或破坏我的代码.

我特别关注迁移,因为自我的代码以来迁移API似乎有所改变,而且我不确定如果我只是更新我的版本,我的迁移是否会中断.遗憾的是,没有关于在其网页上升级Realm版本的文档.

有没有人有升级Realm的经验,特别是两个主要版本的版本增加?

解决方法:

可以在他们的Github上的CHANGELOG.MD中获得重大更改列表.

然而,值得注意的是,路上有很多突破性变化,尤其是0.89.0.

从0.82.0到5.1.0是以下(这是目前最稳定的版本):

0.82.0:

BREAKING CHANGE: FIElds with annotation @PrimaryKey are indexed automatically Now. older schemas require a migration.

(0.82.2在这里最稳定,但它在BlackBerry设备上不起作用.在BlackBerry上使用的第一个稳定版本是0.87.2.)

在0.86.0中,您可以使用添加索引到带注释的字段

@OverrIDepublic voID migrate(final DynamicRealm realm, long oldVersion, long newVersion) {    RealmSchema schema = realm.getSchema();    // version check and stuff    RealmObjectSchema personSchema = schema.get("Person");    personSchema.addindex("fIEldname");

0.83:

BREAKING CHANGE: Database file format update. The Realm file created by this version cannot be used by prevIoUs versions of Realm.

BREAKING CHANGE: Removed deprecated methods and constructors from the Realm class.

BREAKING CHANGE: Introduced Boxed types Boolean, Byte, Short, Integer, Long, float and Double. Added null support. Introduced annotation @required to indicate a fIEld is not nullable. String, Date and byte[] became nullable by default which means a RealmMigrationNeededException will be thrown if an prevIoUs version of a Realm file is opened.

哦,孩子,这是一个很好的. NulL支持.

原始的盒装类型变得可用.盒装类型默认为可以为空.所有String,Date和byte []必须使用@required或schema.setNullable(“fIEldname”,nullability)进行注释,并使它们都可以为空.

0.84.0:

添加了异步查询.在架构方面没有什么新东西.

0.85.0:

BREAKING CHANGE: Removed RealmEncryptionNotSupportedException since the encryption implementation changed in Realm’s underlying storage engine. Encryption is Now supported on all devices.

BREAKING CHANGE: Realm.executeTransaction() Now directly throws any RuntimeException instead of wrapPing it in a RealmException (#1682).

BREAKING CHANGE: Realmquery.isNull() and Realmquery.isNotNull() Now throw IllegalArgumentException instead of RealmError if the fIEldname is a linked fIEld and the last element is a link (#1693).

这里没有什么重要的,但是:

Setters in managed object for RealmObject and RealmList Now throw IllegalArgumentException if the value contains an invalID (unmanaged, removed, closed, from different Realm) object (#1749).

这是一个有趣的.以前只是失败了,所以这是最好的.但它也是Realm最大的限制.

0.86.0:

BREAKING CHANGE: The Migration API has been replaced with a new API.

BREAKING CHANGE: RealmResults.soRT_ORDER_ASCENDING and RealmResults.soRT_ORDER_DESCENDING constants have been replaced by Sort.ASCENDING and Sort.DESCENDING enums.

BREAKING CHANGE: Realmquery.CASE_SENSITIVE and Realmquery.CASE_INSENSITIVE constants have been replaced by Case.SENSITIVE and Case.INSENSITIVE enums.

BREAKING CHANGE: Realm.addchangelistener, RealmObject.addchangelistener and RealmResults.addchangelistener hold a strong reference to the Listener, you should unregister the Listener to avoID memory leaks.

BREAKING CHANGE: Removed deprecated methods Realmquery.minimum{Int,float,Double}, Realmquery.maximum{Int,float,Double}, Realmquery.sum{Int,float,Double} and Realmquery.average{Int,float,Double}. Use Realmquery.min(), Realmquery.max(), Realmquery.sum() and Realmquery.average() instead.

BREAKING CHANGE: Removed RealmConfiguration.getSchemaMediator() which is public by mistake. And RealmConfiguration.getRealmObjectClasses() is added as an alternative in order to obtain the set of model classes (#1797).

BREAKING CHANGE: Realm.addchangelistener, RealmObject.addchangelistener and RealmResults.addchangelistener will throw an IllegalStateException when invoked on a non-Looper thread. This is to prevent registering Listeners that will not be invoked.

Added new Dynamic API using DynamicRealm and DynamicRealmObject.

Added Realm.getSchema() and DynamicRealm.getSchema().

new Migration API, using DynamicRealm instead of Realm.getTable().

某些内容已重命名,如果结果集仍然有效,则应取消注册更改侦听器.但是值得注意的是,你仍然应该为你的RealmResults保留一个字段变量,因为Realm的Context只有一个弱引用.

0.87.0:

RX支持.没有要紧的.

0.87.2:

Removed explicit GC call when committing a transaction (#1925).

最后,Realm又恢复了稳定! 总结

以上是内存溢出为你收集整理的在Android项目中升级领域全部内容,希望文章能够帮你解决在Android项目中升级领域所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1103566.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存