---
title: "migrateStore(from:sourceType:options:with:toDestinationURL:destinationType:destinationOptions:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsmigrationmanager/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.

## Declaration

```swift
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 doc://com.apple.coredata/documentation/CoreData/NSPersistentStoreCoordinator for possible values).
- `sOptions`: A dictionary of options for the source (see doc://com.apple.coredata/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 doc://com.apple.coredata/documentation/CoreData/NSPersistentStoreCoordinator for possible values).
- `dOptions`: A dictionary of options for the destination (see doc://com.apple.coredata/documentation/CoreData/NSPersistentStoreCoordinator for possible values).

## Discussion

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

### Related Documentation

- [cancelMigrationWithError(_:)](coredata/nsmigrationmanager/cancelmigrationwitherror(_:).md)

### Performing a Migration

- [migrateStore(from:type:options:mapping:to:type:options:)](coredata/nsmigrationmanager/migratestore(from:type:options:mapping:to:type:options:).md)
