<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSMigrationManager/migrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMigrationManager(im)migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:"
  },
  "title" : "migrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:)"
}
-->

# 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.

```
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) throws
```

## Parameters

`sourceURL`

The location of an existing persistent store. A store must exist at this URL.

`sStoreType`

The type of store at `sourceURL` (see [`NSPersistentStoreCoordinator`](/documentation/CoreData/NSPersistentStoreCoordinator) for possible values).

`sOptions`

A dictionary of options for the source (see [`NSPersistentStoreCoordinator`](/documentation/CoreData/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`](/documentation/CoreData/NSPersistentStoreCoordinator) for possible values).

`dOptions`

A dictionary of options for the destination (see [`NSPersistentStoreCoordinator`](/documentation/CoreData/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.

## See Also

[`-  cancelMigrationWithError:`](/documentation/CoreData/NSMigrationManager/cancelMigrationWithError(_:))

Cancels the migration with a given error.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)