WIP: Migrations

This commit is contained in:
John Estropia
2017-04-20 20:26:11 +09:00
parent a543a4c94a
commit 02a660e4a6
11 changed files with 205 additions and 77 deletions

View File

@@ -29,9 +29,21 @@ import Foundation
// MARK: - DynamicSchema
/**
`DynamicSchema` are types that provide `NSManagedObjectModel` instances for a particular model version. CoreStore currently supports concrete types:
- `XcodeDataModelSchema`: describes models loaded from a .xcdatamodeld file.
- `LegacyXcodeDataModelSchema`: describes models loaded directly from an existing `NSManagedObjectModel`. It is not advisable to continue using this model as its metadata are not available to CoreStore.
- `CoreStoreSchema`: describes models written in `CoreStoreObject` Swift class declarations.
*/
public protocol DynamicSchema {
/**
The version string for this model schema.
*/
var modelVersion: ModelVersion { get }
/**
Do not call this directly. The `NSManagedObjectModel` for this schema may be created lazily and using this method directly may affect the integrity of the model.
*/
func rawModel() -> NSManagedObjectModel
}

View File

@@ -1,5 +1,5 @@
//
// LegacyXcodeDataModel.swift
// LegacyXcodeDataModelSchema.swift
// CoreStore
//
// Copyright © 2017 John Rommel Estropia
@@ -27,9 +27,9 @@ import CoreData
import Foundation
// MARK: - LegacyXcodeDataModel
// MARK: - LegacyXcodeDataModelSchema
public final class LegacyXcodeDataModel: DynamicSchema {
public final class LegacyXcodeDataModelSchema: DynamicSchema {
public required init(modelName: ModelVersion, model: NSManagedObjectModel) {

View File

@@ -1,5 +1,5 @@
//
// XcodeDataModel.swift
// XcodeDataModelSchema.swift
// CoreStore
//
// Copyright © 2017 John Rommel Estropia
@@ -27,9 +27,9 @@ import CoreData
import Foundation
// MARK: - XcodeDataModel
// MARK: - XcodeDataModelSchema
public final class XcodeDataModel: DynamicSchema {
public final class XcodeDataModelSchema: DynamicSchema {
public required init(modelVersion: ModelVersion, modelVersionFileURL: URL) {