-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Migrations #342
Migrations #342
Conversation
Previous discussion: #334 |
@jpsim commented:
In general I would agree, but in this case the schema pointed to by the realm will change during the course of the migration, so the version number will not remain accurate. The |
So how about RLMMigration.initialVersion? |
initialVersion kinda feels like it should be v1 startingVersion or startVersion maybe? On Wed, May 28, 2014 at 10:42 AM, JP Simard [email protected]:
|
oldVersion? On Wed, May 28, 2014 at 10:45 AM, Tim Anglade [email protected]:
|
previousVersion? priorVersion? fromVersion/toVersion? |
Thinking about this a bit more, I think we should pass the version into the On Wed, May 28, 2014 at 10:49 AM, JP Simard [email protected]:
|
I updated the apis passing the oldVersion into the block. I like this more (hopefully you will agree) |
I like it! On Wednesday, May 28, 2014, Ari Lazier [email protected] wrote:
|
Go for it! |
Closed as all comments are way out of date or already incorporated |
This pr adds support for Realm migrations.
The basic design is to automatically add new object types and properties without requiring user intervention. When a user updates the schema for an object, they must execute a migration block which returns a new version before opening the realm. During the migration, all new columns and objects are created automatically, and an api is provided to enumerate objects of a given type to allow you to populate new columns from data in the old version of the same object.
As a side effect of these changes, we also needed to change the way we do accessors - instead of doing class replacement for invalid and readonly objects, we now do a check before each call that the accessor is attached and that the realm is writable for mutations. This is needed until c accessors support object level notifications which will allow us to switch back to the other model in the future if desired. Inline methods have been added for getting/setting each type and performing any necessary validation, so that we still only have a single entry point in the code for accessing each type.