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
Use default property values when adding a new column in a migration #1793
Comments
This one bit me as well. Is there any timeframe on this or would it maybe be an idea to note it in the migration documentation? |
I just added this to our docs: https://realm.io/docs/objc/latest/#migrations
|
I hope this will be fixed soon as it's difficult for the developers to test if the migrated DB works for each of the previous versions of the realm. (after 90 updates in our case) We recently received errors because of unexpected null string properties (with normally a default value of @""), when we released a major update of our app. |
The challenge here is to only ever set default values if they haven't explicitly been set by a user, which in turn requires tracking which setters were invoked. |
This does seem challenging. I would imagine if a user explicitly set a properties value back to the default, it should not be automatically migrated if the default changes. It almost seems that there ought to be some sort of EDIT: I just realized that this issue only pertains to new columns, which simplifies it. |
@jpsim Couldn't we also strictly set the default values before the user sets the property? |
Yes, I think eagerly setting default values before user set the property would be acceptable. It shouldn't have a significant performance impact, but I'd prefer if we checked nonetheless. |
So what is solution for assigning default value for new Column after migration ? any magical method ? |
No magic. Set manually :( |
setting manually (reference) |
Any solution or fix to this issue? |
Still happens here, any progress on this? |
No description provided.
The text was updated successfully, but these errors were encountered: