mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-05-02 05:24:22 +02:00
WIP: StorageInterface
This commit is contained in:
@@ -73,8 +73,7 @@ public extension DataStack {
|
||||
URL: nil,
|
||||
options: storage.storeOptions
|
||||
)
|
||||
self.updateMetadataForPersistentStore(persistentStore)
|
||||
storage.internalStore = persistentStore
|
||||
self.updateMetadataForStorage(storage, persistentStore: persistentStore)
|
||||
|
||||
GCDQueue.Main.async {
|
||||
|
||||
@@ -147,7 +146,8 @@ public extension DataStack {
|
||||
let fileManager = NSFileManager.defaultManager()
|
||||
|
||||
do {
|
||||
_ = try? fileManager.createDirectoryAtURL(
|
||||
|
||||
try fileManager.createDirectoryAtURL(
|
||||
fileURL.URLByDeletingLastPathComponent!,
|
||||
withIntermediateDirectories: true,
|
||||
attributes: nil
|
||||
@@ -168,9 +168,9 @@ public extension DataStack {
|
||||
|
||||
if storage.resetStoreOnModelMismatch && error.isCoreDataMigrationError {
|
||||
|
||||
fileManager.removeSQLiteStoreAtURL(fileURL)
|
||||
do {
|
||||
|
||||
try _ = self.model[metadata].flatMap(storage.eraseStorageAndWait)
|
||||
try self.addStorageAndWait(storage)
|
||||
|
||||
GCDQueue.Main.async {
|
||||
@@ -282,10 +282,6 @@ public extension DataStack {
|
||||
options: storage.storeOptions
|
||||
)
|
||||
}
|
||||
catch let error as NSError where error.code == NSFileReadNoSuchFileError && error.domain == NSCocoaErrorDomain {
|
||||
|
||||
return []
|
||||
}
|
||||
catch {
|
||||
|
||||
CoreStore.handleError(
|
||||
@@ -508,8 +504,6 @@ public extension DataStack {
|
||||
isDirectory: false
|
||||
)
|
||||
|
||||
try storage.eraseStorageAndWait()
|
||||
|
||||
let migrationManager = MigrationManager(
|
||||
sourceModel: sourceModel,
|
||||
destinationModel: destinationModel,
|
||||
|
||||
Reference in New Issue
Block a user