I use MagicalRecord to work with the CoreData model, which is likely to be versioned in the future.
Now I need to add to my application a pre-populated database with about 80,000 objects with one entity; this data is static, and I do not expect it to ever change.
If I added this entity to an existing model, I would need to generate a new seed db every time the model changes, increasing the complexity of the project.
The best solution would be to create a second model, only for a new object: the seed db will never change, and the first model can take care of its version, regardless of the new model. No relationship between the two models is required.
In addition to the existing model, I also use RestKit, and here, as everything is configured:
[MagicalRecord setupAutoMigratingCoreDataStack];
RKManagedObjectStore *managedObjectStore =
[[RKManagedObjectStore alloc] initWithPersistentStoreCoordinator:
[NSPersistentStoreCoordinator MR_newPersistentStoreCoordinator]];
self.objectManager.managedObjectStore = managedObjectStore;
[managedObjectStore createManagedObjectContexts];
[NSManagedObjectContext MR_setRootSavingContext:
managedObjectStore.persistentStoreManagedObjectContext];
[NSManagedObjectContext MR_setDefaultContext:
managedObjectStore.mainQueueManagedObjectContext];
managedObjectStore.managedObjectCache = [[RKFetchRequestManagedObjectCache alloc] init];
The new model will not be used with RestKit.
Is this possible with MagicalRecord? I went through his documentation, but could find something useful.
Thanks a lot, DAN
UPDATE
db 4 (Foo, Bar, Blarg, Baz), xcode.
, , (SeedConfiguration UserConfiguration), Foo , - .
seed.sqlite user.sqlite.
script, seed.sqlite Foo: ; user.sqlite .
"script" seed.sqlite, sqlite , , Foo seed.sqlite Bar, Blarg, Baz user.sqlite.
Foo seed.sqlite, () ?
:
qaru.site/questions/531130/...
, sqlite, , db , .