realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.
Apache License 2.0
967 stars 61 forks source link

Android: Realm data getting loss when migrating from Java to Kotlin #1840

Open rajeshct opened 2 months ago

rajeshct commented 2 months ago

How frequently does the bug occur?

Always

Description

When migrating from Realm-Java to Realm-Kotlin, data is not migrated. There is no change in schema and classes, I tested this by creating a project which uses the same database but difference in usage of SDK.

Realm Java version: 10.17.0 Realm Kotlin version: 1.16.0

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

Added Sample project in attachment: 1) First run the app which will save data in the older realm. 2) Then run myLibray which will fetch data from the older realm. Ideally, it should migrate as there is no change in class.

I have noticed one thing when checking in device explore it creates two .realm file 1) tst.realm and 2) tst.v23.backup.realm

When tried to open these databases with Realm Studio, tst.v23.backup.realm contains data while tst.realm doesn't contain any data. Is there any way to move data from tst.v23.backup.realm to tst.realm?

TestRealm.zip

https://github.com/user-attachments/assets/732eea2d-2cd6-4b09-a969-baf25754c667

Version

1.16.0 and latest

What Atlas App Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

Android 15

Build environment

Android Studio version: Android Studio Koala Feature Drop | 2024.1.2 Android Build Tools version: Gradle version: 8.5.2

sync-by-unito[bot] commented 2 months ago

➤ PM Bot commented:

Jira ticket: RKOTLIN-1129