I started developing an Android app using Realm, but if I change the column name and type, the app will drop.Even if you change one of them, the app will drop.
·Create method (add new record)
·Read method (get value)
·Display the values obtained in TextView
·Column name: name(String), price(Long)
Tried Realm on Kotlin+Android. - Qiita
While looking at various sites, mainly the above sites, it worked well to get the value by adding records, but I had to change it to the following because I named the column as written on the site.
DataBase.kt Column Name and Type
MainActivity.kt Create Method Arguments and the Value of Arguments in Specified Items
This is because the data structure and class definition of the objects already stored in the Realm file are different.
There are two solutions:
deleteIfMigrationNeeded() with the setting that if the application is not yet released and you can erase existing data, or automatically delete and regenerate the file if the data structure is different in
RealmConfiguration.Realm will automatically delete the existing file and regenerate it with the new data structure.
If the existing data cannot be erased, write the migration.This is an intentional change in the data structure to Realm, and this is the process of informing Realm of the change.
For more information
See the .
356 I want to create an array of sequences from "1" to a specified number.
372 Update Flask User Information
367 To Limit Column Values to Strings in a String List Using sqlalchemy
356 Unity Virtual Stick Does Not Return to Center When You Release Your Finger
© 2023 OneMinuteCode. All rights reserved.