Cleaning up after manual Core Data migration
Cleaning up after manual Core Data migration
- Subject: Cleaning up after manual Core Data migration
- From: Rick Mann <email@hidden>
- Date: Thu, 11 Sep 2014 15:38:32 -0700
Up until now I've performed a complex Core Data migration using Mapping Models and custom migration policy subclasses, but initiated automatically upon creating the persistent store coordinator, and it works fine. But unfortunately, it's taking too long, so I have to initiate it manually on a background thread, with an instance of a migration manager I create, and then display some progress.
The problem is, I now have to specify the destination URL explicitly, and I'm not able to give it the source URL. So, I create a new sqlite data file, and that's fine. But the old sqlite DB actually has three files (DB.sqlite, DB.sqlite-shm, DB.sqlite-wal), so when I swap the new and old files after the migration completes, there's still leftover sqlite metadata in the form of these additional files, and SQLite thinks the newly migrated DB is corrupt.
I can, of course, just delete these additional files, but it's an implementation detail I'd rather not put in my code. Am I overlooking some more elegant way to update the on-disk files?
TIA,
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden