renamed "Incremental Migrations" to "Progressive Migrations" to match the common term used by the community

This commit is contained in:
John Estropia
2016-02-17 15:34:33 +09:00
parent 8c8953c507
commit 37bf4179c8
5 changed files with 13 additions and 12 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ CoreStoreDemo/CoreStoreDemo.xcodeproj/xcuserdata
Carthage/Build Carthage/Build
CoreStore.xcworkspace/xcuserdata CoreStore.xcworkspace/xcuserdata
.DS_Store .DS_Store
DerivedData

View File

@@ -30,14 +30,14 @@ import CoreData
// MARK: - MigrationChain // MARK: - MigrationChain
/** /**
A `MigrationChain` indicates the sequence of model versions to be used as the order for incremental migration. This is typically passed to the `DataStack` initializer and will be applied to all stores added to the `DataStack` with `addSQLiteStore(...)` and its variants. A `MigrationChain` indicates the sequence of model versions to be used as the order for progressive migrations. This is typically passed to the `DataStack` initializer and will be applied to all stores added to the `DataStack` with `addSQLiteStore(...)` and its variants.
Initializing with empty values (either `nil`, `[]`, or `[:]`) instructs the `DataStack` to use the .xcdatamodel's current version as the final version, and to disable incremental migrations: Initializing with empty values (either `nil`, `[]`, or `[:]`) instructs the `DataStack` to use the .xcdatamodel's current version as the final version, and to disable progressive migrations:
``` ```
let dataStack = DataStack(migrationChain: nil) let dataStack = DataStack(migrationChain: nil)
``` ```
This means that the mapping model will be computed from the store's version straight to the `DataStack`'s model version. This means that the mapping model will be computed from the store's version straight to the `DataStack`'s model version.
To support incremental migrations, specify the linear order of versions: To support progressive migrations, specify the linear order of versions:
``` ```
let dataStack = DataStack(migrationChain: let dataStack = DataStack(migrationChain:
["MyAppModel", "MyAppModelV2", "MyAppModelV3", "MyAppModelV4"]) ["MyAppModel", "MyAppModelV2", "MyAppModelV3", "MyAppModelV4"])

View File

@@ -55,7 +55,7 @@ public final class DataStack {
- parameter modelName: the name of the (.xcdatamodeld) model file. If not specified, the application name will be used. - parameter modelName: the name of the (.xcdatamodeld) model file. If not specified, the application name will be used.
- parameter bundle: an optional bundle to load models from. If not specified, the main bundle will be used. - parameter bundle: an optional bundle to load models from. If not specified, the main bundle will be used.
- parameter migrationChain: the `MigrationChain` that indicates the sequence of model versions to be used as the order for incremental migration. If not specified, will default to a non-migrating data stack. - parameter migrationChain: the `MigrationChain` that indicates the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.
*/ */
public required init(modelName: String = applicationName, bundle: NSBundle = NSBundle.mainBundle(), migrationChain: MigrationChain = nil) { public required init(modelName: String = applicationName, bundle: NSBundle = NSBundle.mainBundle(), migrationChain: MigrationChain = nil) {

View File

@@ -39,7 +39,7 @@ class MigrationsDemoViewController: UIViewController {
let alert = UIAlertController( let alert = UIAlertController(
title: "Migrations Demo", title: "Migrations Demo",
message: "This demo shows how to run incremental migrations and how to support multiple model versions in a single project.\n\nThe persistent store contains 10000 organisms, which gain/lose properties when the migration evolves/devolves them.\n\nYou can use the \"mutate\" button to change an organism's properties then migrate to a different model to see how its value gets affected.", message: "This demo shows how to run progressive migrations and how to support multiple model versions in a single project.\n\nThe persistent store contains 10000 organisms, which gain/lose properties when the migration evolves/devolves them.\n\nYou can use the \"mutate\" button to change an organism's properties then migrate to a different model to see how its value gets affected.",
preferredStyle: .Alert preferredStyle: .Alert
) )
alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: nil)) alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: nil))
@@ -267,7 +267,7 @@ class MigrationsDemoViewController: UIViewController {
self.progressView?.setProgress(Float(progress.fractionCompleted), animated: true) self.progressView?.setProgress(Float(progress.fractionCompleted), animated: true)
self.titleLabel?.text = "Migrating: \(progress.localizedDescription)" self.titleLabel?.text = "Migrating: \(progress.localizedDescription)"
self.organismLabel?.text = "Incremental step \(progress.localizedAdditionalDescription)" self.organismLabel?.text = "Progressive step \(progress.localizedAdditionalDescription)"
} }
private func updateDisplay(reloadData reloadData: Bool, scrollToSelection: Bool, animated: Bool) { private func updateDisplay(reloadData reloadData: Bool, scrollToSelection: Bool, animated: Bool) {

View File

@@ -15,7 +15,7 @@ Unleashing the real power of Core Data with the elegance and safety of Swift
## What CoreStore does better: ## What CoreStore does better:
- **Heavily supports multiple persistent stores per data stack**, just the way *.xcdatamodeld* files are designed to. CoreStore will also manage one data stack by default, but you can create and manage as many as you need. - **Heavily supports multiple persistent stores per data stack**, just the way *.xcdatamodeld* files are designed to. CoreStore will also manage one data stack by default, but you can create and manage as many as you need.
- **Incremental Migrations!** Just tell the data stack the sequence of model versions and CoreStore will automatically use incremental migrations if needed on stores added to that stack. - **Progressive Migrations!** Just tell the data stack the sequence of model versions and CoreStore will automatically use progressive migrations if needed on stores added to that stack.
- Ability to **plug-in your own logging framework** - Ability to **plug-in your own logging framework**
- Gets around a limitation with other Core Data wrappers where the entity name should be the same as the `NSManagedObject` subclass name. CoreStore loads entity-to-class mappings from the managed object model file, so you are **free to name entities and their class names independently**. - Gets around a limitation with other Core Data wrappers where the entity name should be the same as the `NSManagedObject` subclass name. CoreStore loads entity-to-class mappings from the managed object model file, so you are **free to name entities and their class names independently**.
- Provides type-safe, easy to configure **observers to replace `NSFetchedResultsController` and KVO** - Provides type-safe, easy to configure **observers to replace `NSFetchedResultsController` and KVO**
@@ -36,7 +36,7 @@ Unleashing the real power of Core Data with the elegance and safety of Swift
- CoreStore Tutorials (All of these have demos in the **CoreStoreDemo** app project!) - CoreStore Tutorials (All of these have demos in the **CoreStoreDemo** app project!)
- [Setting up](#setting-up) - [Setting up](#setting-up)
- [Migrations](#migrations) - [Migrations](#migrations)
- [Incremental migrations](#incremental-migrations) - [Progressive migrations](#progressive-migrations)
- [Forecasting migrations](#forecasting-migrations) - [Forecasting migrations](#forecasting-migrations)
- [Saving and processing transactions](#saving-and-processing-transactions) - [Saving and processing transactions](#saving-and-processing-transactions)
- [Transaction types](#transaction-types) - [Transaction types](#transaction-types)
@@ -70,7 +70,7 @@ Unleashing the real power of Core Data with the elegance and safety of Swift
## TL;DR (a.k.a. sample codes) ## TL;DR (a.k.a. sample codes)
Setting-up with incremental migration support: Setting-up with progressive migration support:
```swift ```swift
CoreStore.defaultStack = DataStack( CoreStore.defaultStack = DataStack(
modelName: "MyStore", modelName: "MyStore",
@@ -181,7 +181,7 @@ For most cases, this configuration is usable as it is. But for more hardcore set
```swift ```swift
let dataStack = DataStack( let dataStack = DataStack(
modelName: "MyModel", // loads from the "MyModel.xcdatamodeld" file modelName: "MyModel", // loads from the "MyModel.xcdatamodeld" file
migrationChain: ["MyStore", "MyStoreV2", "MyStoreV3"] // model versions for incremental migrations migrationChain: ["MyStore", "MyStoreV2", "MyStoreV3"] // model versions for progressive migrations
) )
do { do {
@@ -291,7 +291,7 @@ progress?.setProgressHandler { [weak self] (progress) -> Void in
This closure is executed on the main thread so UIKit calls can be done safely. This closure is executed on the main thread so UIKit calls can be done safely.
### Incremental migrations ### Progressive migrations
By default, CoreStore uses Core Data's default automatic migration mechanism. In other words, CoreStore will try to migrate the existing persistent store to the *.xcdatamodeld* file's current model version. If no mapping model is found from the store's version to the data model's version, CoreStore gives up and reports an error. By default, CoreStore uses Core Data's default automatic migration mechanism. In other words, CoreStore will try to migrate the existing persistent store to the *.xcdatamodeld* file's current model version. If no mapping model is found from the store's version to the data model's version, CoreStore gives up and reports an error.
The `DataStack` lets you specify hints on how to break a migration into several sub-migrations using a `MigrationChain`. This is typically passed to the `DataStack` initializer and will be applied to all stores added to the `DataStack` with `addSQLiteStore(...)` and its variants: The `DataStack` lets you specify hints on how to break a migration into several sub-migrations using a `MigrationChain`. This is typically passed to the `DataStack` initializer and will be applied to all stores added to the `DataStack` with `addSQLiteStore(...)` and its variants:
@@ -314,7 +314,7 @@ This allows for different migration paths depending on the starting version. The
- MyAppModelV2-MyAppModelV4 - MyAppModelV2-MyAppModelV4
- MyAppModelV3-MyAppModelV4 - MyAppModelV3-MyAppModelV4
Initializing with empty values (either `nil`, `[]`, or `[:]`) instructs the `DataStack` to disable incremental migrations and revert to the default migration behavior (i.e. use the .xcdatamodel's current version as the final version): Initializing with empty values (either `nil`, `[]`, or `[:]`) instructs the `DataStack` to disable progressive migrations and revert to the default migration behavior (i.e. use the .xcdatamodel's current version as the final version):
```swift ```swift
let dataStack = DataStack(migrationChain: nil) let dataStack = DataStack(migrationChain: nil)
``` ```