Saturday, March 9, 2024
HomeiOS Developmentios - Do I have to carry out a migration block when...

ios – Do I have to carry out a migration block when updating @PersistableEnum?


I’ve a realm mannequin setup like this:

enum RealmEnumExample: String, Codable, PersistableEnum {
    case scorching, chilly, cloudy, wet
}

closing class RealmExample: Object, ObjectKeyIdentifiable {
    @Endured(primaryKey: true) var id: Int
    @Endured var climate: RealmEnumExample
    
    init(id: Int, climate: RealmEnumExample) {
        
        tremendous.init()
        self.id = id
        self.climate = climate
    }
    
    override init() {
        tremendous.init()
    }
}

If I take away chilly and cloudy from RealmNumExample and add heat do I have to carry out a realm migration block along with updating the schema model? Realm documentation says that when including and eradicating properties realm routinely does the migration for you however it’s not clear with PersistableEnums in circumstances like these. When would renaming a property be related on this instance? Shall we say I “renamed” cloudy to heat would not that be the identical as eradicating cloudy and including heat, due to this fact, not needing a migration block in that case as effectively and solely needing to replace the schema model?

I’m confused on when it will be applicable to resort to “renaming” properties on this state of affairs and doing a migration block or permitting realm to do the migration whether it is dealing with it as including and eradicating properties.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments