-
Notifications
You must be signed in to change notification settings - Fork 167
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
Added missing migration methods #2635
Conversation
} | ||
|
||
return true; | ||
} | ||
|
||
/// <summary> | ||
/// Removes a type during a migration. All the data associated with the type, as well as its schema, will be removed from <see cref="Realm"/>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to differentiate between the (general) schema and the object schema to not confuse anyone here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's clear enough with the "its", but maybe it's not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear enough for me because I know how Realm works and what the difference between a schema and an object schema is. Then again, how important is this for a user? They just want to use the framework and not understand too much about the internals I suppose. I guess it's fine both ways. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see anything wrong with that. :) Just added two questions for clarification.
A question is... Do we want the two method to work in the same way for what regards using a type that is not in the schema? |
Removing a type that no longer exists (or never existed) is probably not an exception-worthy situation. You do end up in the same state - a Realm without this particular type. Renaming a property that didn't exist vs one that did exist is different as you would expect to have some data appear in your new Realm - that's the main point of using RenameProperty vs just deleting the old one and adding the new one. So if it turns out you're trying to rename something non-existent, that's likely a mistake and we should let you know. |
The non-throwing delete would also be in line with other deletes. Take |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of comments mostly around code style and docs, but for the most part it looks good. What is missing outside of the comments I added is:
- Tests for invalid arguments (null, empty strings, a string with 1000 characters)
- A test for renaming a property to a value that doesn't exist in the new schema
- Address the build warnings/CodeQL errors
Can you rebase on master? There was a Coveralls outage over the weekend which is why the base coverage report is missing. |
Pull Request Test Coverage Report for Build 1286514500
💛 - Coveralls |
Final corrections done (lint correction, more tests, ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
# Conflicts: # Tests/Realm.Tests/Database/MigrationTests.cs
This PR adds two methods that were missing on
Migration
:RemoveType
andRenameProperty
.Description
Fixes #2543
TODO