-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support renaming tables in migration #2491
Comments
Is there a workaround to rename a class that works with the current version of RealmSwift? Based on the ObjC example, I've created this configuration: let config = Realm.Configuration(
schemaVersion: 2,
migrationBlock: { migration, oldSchemaVersion in
if (oldSchemaVersion < 2) {
migration.enumerate("Person", { (oldObject, newObject) in
if let oldObject = oldObject {
print(oldObject)
migration.create("Employee", value: oldObject)
}
})
}
}) This does print the first Update: I've noticed that the crash is due to one of fields being an (optional) RealmObject. If I nil that out, it doesn't crash. |
This is only unhelpful if you choose to ignore the exception message. From your update to your comment, it seems like your two classes may have different schemas? |
Ah, I didn't know you could catch NSExceptions in Swift, but I got it to work. This is the error that occurs: The only change I made to the schema is renaming the Object. |
Any plans to support this on the roadmap? |
It's been already implemented.. So simple to be added, but still not merged. :( |
TOP |
So is this available yet or still not merged in? |
Another 4 years have passed, is there any update on this feature? It's as easy in Android as: Very frustrating we cant do this for iOS |
@mattlewer Realm is now dead, there won't be such a feature unless you contribute it yourself |
@aehlke How do you mean it's dead, last release was 2 weeks ago? |
@mattlewer it's recently deprecated and will not receive any more commits or releases from parent company later next year. it's transitioning to an open source framework without any parent company supporting it. there's been very little community contribution until now so I don't expect it to become very active after Mongo step down. |
As originally requested here: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/realm-cocoa/sLd7S-jSX40/FeQSRPW0BwAJ
This could be exposed as
-[RLMMigration renameModelFrom:(NSString *)oldName to:(NSString *)newName]
, which would use core'sGroup::rename_table()
function.The text was updated successfully, but these errors were encountered: