migrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:)
Migrates the store at a given source URL to the store at a given destination URL, performing all of the mappings specified in a given mapping model.
Declaration
func migrateStore(from sourceURL: URL, sourceType sStoreType: String, options sOptions: [AnyHashable : Any]? = nil, with mappings: NSMappingModel?, toDestinationURL dURL: URL, destinationType dStoreType: String, destinationOptions dOptions: [AnyHashable : Any]? = nil) throwsParameters
- sourceURL:
The location of an existing persistent store. A store must exist at this URL.
- sStoreType:
The type of store at
sourceURL(see Nspersistentstorecoordinator for possible values). - sOptions:
A dictionary of options for the source (see Nspersistentstorecoordinator for possible values).
- mappings:
The mapping model to use to effect the migration.
- dURL:
The location of the destination store.
- dStoreType:
The type of store at
dURL(see Nspersistentstorecoordinator for possible values). - dOptions:
A dictionary of options for the destination (see Nspersistentstorecoordinator for possible values).
Discussion
This method performs compatibility checks on the source and destination models and the mapping model.
Special Considerations
If a store does not exist at the destination URL (dURL), one is created; otherwise, the migration appends to the existing store.