realm-migration

perform realm migration for multiple .realm files

醉酒当歌 提交于 2019-12-11 12:04:58
问题 i have multiple realm files, (one per user logged into my app) and i need to run a migration for each realm file in the file system RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration]; config.schemaVersion = 1; config.migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) { if (oldSchemaVersion < 1) { //do the same changes for all file.realm in the filesystem } }; [RLMRealmConfiguration setDefaultConfiguration:config]; [RLMRealm defaultRealm]; how can

How to add existing objects on a new class on Realm Migration in Android

前提是你 提交于 2019-12-07 07:30:51
问题 I have an app on production, so changes has to be applied with a RealmMigration I've looked the documentation and this example but I didn't find how to do the following. In current version I have items of type Foo that has a boolean property called favorite . Now I want to generalize that and create user custom Foo lists, so the users will be able to create their custom lists and add as many objects as they want. I want to implement this with a new class called UserFooList with basically name

Migration on Realm 0.81.1

断了今生、忘了曾经 提交于 2019-12-07 04:06:38
问题 Got different exception after adding objects. migration needed class not found in scheme version on disk is newer than requested What is wrong? 1 - MainActivity.java RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(context) .build(); Realm.setDefaultConfiguration(realmConfiguration); Realm realm = Realm.getDefaultInstance(); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { RealmTestObjectOne testObjectOne = new

How to add existing objects on a new class on Realm Migration in Android

我与影子孤独终老i 提交于 2019-12-05 15:20:25
I have an app on production, so changes has to be applied with a RealmMigration I've looked the documentation and this example but I didn't find how to do the following. In current version I have items of type Foo that has a boolean property called favorite . Now I want to generalize that and create user custom Foo lists, so the users will be able to create their custom lists and add as many objects as they want. I want to implement this with a new class called UserFooList with basically name and a RealmList<Foo> of elements. In migration process I'm creating this new class with its fields.

Create a realm object during a Realm Migration

跟風遠走 提交于 2019-12-05 09:56:52
Are you able to create a realm Object during a migration? I am wanting to extract part of an existing realm object and create a new object with that data, but the migration always hangs up. Here is my migration code private class var migrationBlock: MigrationBlock { return { migration, oldSchemaVersion in if oldSchemaVersion < 1 { print("Shema Version 0") migration.enumerate(Transaction.className(), { (oldObject, newObject) -> Void in let oldDate = oldObject!["date"] as! NSDate let newTransactionDate = TransactionDate() newTransactionDate.date = oldDate try! Realm.getRealm().write { Realm

Perform migration by adding List() and another model class

ぐ巨炮叔叔 提交于 2019-12-01 05:08:46
问题 I have the following models class Area: Object { // Specify properties to ignore (Realm won't persist these) // override static func ignoredProperties() -> [String] { // return [] // } dynamic var id = 0 dynamic var name = "" override static func primaryKey() -> String? { return "id" } } class Region: Object { // Specify properties to ignore (Realm won't persist these) // override static func ignoredProperties() -> [String] { // return [] // } dynamic var id = 0 dynamic var name = "" override