-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
Currently Java (and later Kotlin) has support for a configuration mode called RealmConfiguration.deleteRealmIfMigrationRequired(). This mode is intended during development as an easy way to iterate on schemas without manually deleting the Realm file.
This logic is currently implemented in Java as ObjectStore only has partial support for this. The closest ObjectStore has is this
// If the schema version matches and the only schema changes are new // tables and indexes being added or removed, apply the changes to // the existing file. // Otherwise delete the file and recreate it from scratch. // The migration function is not used. // // This mode allows using schemata with different subsets of tables // on different threads, but the tables which are shared must be // identical. ResetFile,
Which on the surface does the right thing, but it has problematic consequences, namely that old data are still left in the file which makes it hard to reason about from an end-user perspective and doesn't play nice with another feature that Java has (Config::initialization_function Which populates the Realm the first time the Realm is created).
I would like to propose the following:
- Rename SchemaMode::ResetFile to SchemaMode::SoftResetFile
- Introduce a new schema mode: SchemaMode::HardResetFile which will delete the file on any migration.
- is depended on by
-
RKOTLIN-225 SchemaMode::ResetFile does not trigger a hard reset
- Closed