mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-11 21:11:58 +01:00
WIP: Migrations
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user