-
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
Support specifying objectSchema/classes to be stored in a Realm #1506
Comments
Right now, there is no way to only have certain classes in certain Realms (there will be database tables created for all of your RLMObject subclasses), but the overhead from those empty tables is negligible. I hope that helps! |
this could be simpler than it looks ..may be something like .. |
@yasirmturk the issue with require a call like that is that it's counter-intuitive and makes the API harder to use and more confusing to read code that uses Realm. We've never really seen anyone report an issue with the tables that are created, even if they are not used. Do you have a particular reason why you think the ability to register classes would be necessary? |
I think there is a github issue that describes hiding any empty tables so it will end up doing this automatically |
The correct solution will probably be to add the tables lazily, so that
they are not created in the realm until the first time you add an object of
that type to it.
|
@yasirmturk you will be able to do what you are asking once we open up support for our dynamic interface. With the dynamic interface you can open a Realm providing a custom schema, which is basically just a list of the objects/properties stored in the Realm - so eventually you will be able to specify what objects each Realm should support each time it is opened. Not sure yet when we will get around to making this functionality public though. |
@segiddins an overload for advanced users never hurts the beginners using intuitive solution.. another suggestion is to use the method which is specifying migration rules.. @segiddins it is a real mess even if you have 3 realms each having 10 tables and you end up looking at 2 DBs with 30 tables each |
I'd be in favor of allowing users define per-realm models. I think this functionality would be different (simpler) than providing an entire schema in the dynamic interface case. Not having superfluous tables in a db means not having to migrate one realm because the model class for another has changed. How about something similar to Changing which classes are registered for a path would require a migration. This will make it easy for us to support existing users who want to clean up their realm files. |
+100 |
We will likely add this once we add support for RealmConfiguration for Realm initialization |
Great..and i assume it would handle the cleanup of existing Realm DBs in production too |
there is another backdraw ..it requires to migrate all models even if i have added a property in one of my 3 realm models |
This will be implemented as part of #1584 |
What about the cleanup? of older schema versions? |
i have created multiple realm DBs but it creates all classes in every realm..? how to specify a model class for a specific realm?
The text was updated successfully, but these errors were encountered: