`deleteRealmIfMigrationNeeded()` 是否总是删除数据?或者仅当存在 RealmMigrationNeededException 时?

Does `deleteRealmIfMigrationNeeded()` always delete the data? Or only when there is an RealmMigrationNeededException?

https://realm.io/docs/javascript/latest/#opening-realms 领域文档说

deleteRealmIfMigrationNeeded: delete the Realm if migration is needed; this is useful under development since the data model might change often

RealmConfiguration.java 中,它表示

 * Setting this will change the behavior of how migration exceptions are handled. Instead of throwing a
 * {@link io.realm.exceptions.RealmMigrationNeededException} the on-disc Realm will be cleared and recreated
 * with the new Realm schema.

所以我的问题是,deleteRealmIfMigrationNeeded() 是否总是在迁移时删除数据库?还是只有迁移失败才删除?

deleteRealmIfMigrationNeeded() 将在您更改领域 类 结构时删除应用架构。否则它不会删除您的架构。