I am planning a Core Data migration for a macOS app targeting macOS 12 and later and I would appreciate guidance on structuring the rollout to minimise risk.
Context
The app currently uses a SQLite store located at:
~/Library/Containers/com.company.AppName/Data/Library/Application Support/AppName
I want to:
- Relocate the persistent store to an app group container:
~/Library/Group Containers/group.com.company.AppName - Perform schema migration, including:
- Renaming attributes
- Deleting attributes
- Using a custom
NSEntityMigrationPolicysubclass
- Adopt iCloud sync using
NSPersistentCloudKitContainer - Potentially leverage staged migration (macOS 14+)
Additionally, I intend to port the app to iOS, so the end state needs to support an app group container and CloudKit with the latest schema from the outset.
Questions
-
Store relocation vs schema migration
- Is it advisable to perform store relocation and schema migration in a single step, or should these be separate releases?
- If combined, are there pitfalls when moving the SQLite file and running a migration in the same launch cycle?
-
Custom migration policy
- Any best practices for structuring
NSEntityMigrationPolicywhen also relocating the store? - Should migration policies assume the store has already been moved, or handle both concerns?
- Any best practices for structuring
-
Staged migration (macOS 14+)
- Is staged migration worth adopting when still supporting macOS 12–13?
- Would you gate it conditionally, or avoid it entirely for consistency?
-
CloudKit adoption
- Is introducing
NSPersistentCloudKitContainerin the same release as the above migrations too risky? - Are there known issues when enabling CloudKit immediately after a migration?
- Is introducing
-
Release strategy
- Would you recommend:
- A single release handling everything
- Two phases: (1) store & schema migration, (2) CloudKit
- Or three phases: store relocation → schema migration → CloudKit
- Would you recommend:
Goal
I want a smooth, reliable transition without data loss or duplication, particularly for existing users with non-trivial datasets.
Any insights, practical experience, or recommended sequencing strategies would be very helpful.