Questions tagged [realm-migration]

Realm is a databasing system for iOS and Android mobile applications. Then a change is made in the database model it must be "Migrated" to the 'realm' for it to be incorporated into the database scheme.

Realm is a databasing system for iOS and Android mobile applications. When a change is made in the database model it must be "Migrated" to the 'realm' for it to be incorporated into the database scheme.

For information:
https://realm.io/docs/swift/latest/#migrations
https://realm.io/docs/swift/latest/api/

207 questions
29
votes
2 answers

Right way of doing Realm Migration Android

We use Realm for our app. Our app has been beta released. Now I want to add a field to one of our realm objects. So I got to write RealmMigration and I wrote one too. The Question here is how to apply this Realm migration to my app. I use…
User
  • 1,186
  • 4
  • 22
  • 36
9
votes
2 answers

Adding a PrimaryKey to a Realm with tons of duplicate data

I need to add a @PrimaryKey to two Realm models that are missing it due to idiocy. The models are referenced in multiple other models via direct relationships or RealmLists, one of both models also references the other model. My first thought was to…
Strayer
  • 3,050
  • 3
  • 30
  • 40
9
votes
3 answers

How to handle realm migration if users skip updates

So we have a scenario where a user has version 1.0 of an app. Version 2.0 comes out, but the user does not update. When version 3.0 comes out, the user decides to update. Because the user has not updated the app, the realm file has not been updated…
gookman
  • 2,527
  • 2
  • 20
  • 28
8
votes
1 answer

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

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…
pauminku
  • 3,526
  • 3
  • 22
  • 24
8
votes
2 answers

Android Realm Migration: Adding new Realm list column

Im using Realm v0.80.1 and I am trying to write migration code for a new property I added. The property is a RealmList. Im not sure how to properly add the new column or set a a value. What I have: customRealmTable.addColumn(, "list"); Once the…
7
votes
5 answers

Realm cannot migrate

I have a Realm model that I want to apply migrations. However, when I apply the migrations I get the error Configurations cannot be different if used to open the same file. The most likely cause is that equals() and hashCode() are not overridden…
Wers1962
  • 71
  • 2
7
votes
1 answer

Create and add object to RealmList in RealmMigration

In my current app, I have a HolderObject (which extends RealmObject) with a long 'machineId'. In a new version of the app, this HolderObject will be able to contain more machines, in the form of a RealmList. See the classes below: Old object: public…
Marcel50506
  • 1,280
  • 1
  • 14
  • 32
7
votes
1 answer

Realm: change field name for migration

I'd like to change field name in Realm DB migration process. It seems that changing field name is not supported, and only copy-and-remove is the only way to do. is this correct? It consumes lots of time. Below code is my trial to change field value…
Youngjae
  • 24,352
  • 18
  • 113
  • 198
7
votes
5 answers

How can I get the migration to run before the app starts to run the code?

I'm using realm.io in a swift app. This is the first time I've had to run a migration since I have an app in production. I changed one of the models and added a couple of extra fields to it. I followed the example in the documentation and then…
Jason Shultz
  • 940
  • 1
  • 19
  • 36
7
votes
3 answers

Remove column in Realm

I was checking out the migration documentation, however, I'm not sure if I overlooked or it's not stated, but I noticed that the documentation only explains how to add column, what if I want to remove a column?
Happiehappie
  • 1,084
  • 2
  • 13
  • 26
7
votes
1 answer

Create a realm object during a Realm Migration

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…
Nate Mann
  • 695
  • 6
  • 17
6
votes
2 answers

Realm migration issue. How do I Update the data that should be in it

I copy and paste the code from realm doc. But don't know how to change teh section i commented next to to indicate. (at the bottom) Below is the full error message I get: error initializing newrealm, Error Domain=io.realm Code=10 "Migration is…
user10152503
6
votes
1 answer

best way to rename a class in Realm swift

I use a "common" library in my iOS project. This library creates a Realm database. So far, I've been using this library on only iOS projects. I want to now use that same library with a macOS project. It's Foundation based, and doesn't use UIKit, so…
Dan Morrow
  • 4,433
  • 2
  • 31
  • 45
5
votes
0 answers

How to write the schema for the below object in Realm dataBase react native

I am trying to write a schema for the object given below. but, I can't insert the data by using it. can anyone help me to fix it? I have tried for it for one day. [{job_number:"142323", ord_obj_guid:"fdsvghfsdgkh123123c2-dnhfgsdjf", …
ravi
  • 370
  • 4
  • 11
5
votes
1 answer

Migrate from Sqlite to Realm (Android)

My existing app data is on SQlite. I am trying to migrate the data from Sqlite to Realm. I google how to migrate data, but didn't find any solution related to that. I am planning to launch an update version of the existing app. While updating the…
Rabindra Acharya
  • 1,868
  • 2
  • 18
  • 32
1
2 3
13 14