Search code examples
realmrealm-java

Alternate to fallbackToDestructiveMigration()?


I don't want to provide a migration script while changing table schema in realm java. Also, app should not crash and all the previous data should be erased or truncated something similar to fallbackToDestructiveMigration() as room dose?


Solution

  • Realm provides RealmConfiguration.Builder().deleteIfMigrationNeeded()..., where deleteIfMigrationNeeded() does exactly what you are looking for.