mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-20 16:01:20 +02:00
Merge branch 'develop' into prototype/Swift_4_0
# Conflicts: # CoreStore.podspec # Sources/DataStack+Migration.swift # Sources/Info.plist
This commit is contained in:
@@ -683,6 +683,15 @@ public extension DataStack {
|
|||||||
|
|
||||||
private func startMigrationForStorage<T: LocalStorage>(_ storage: T, sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel, mappingModel: NSMappingModel, migrationType: MigrationType, progress: Progress) throws {
|
private func startMigrationForStorage<T: LocalStorage>(_ storage: T, sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel, mappingModel: NSMappingModel, migrationType: MigrationType, progress: Progress) throws {
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
try storage.cs_finalizeStorageAndWait(soureModelHint: sourceModel)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
|
||||||
|
throw CoreStoreError(error)
|
||||||
|
}
|
||||||
|
|
||||||
let fileURL = storage.fileURL
|
let fileURL = storage.fileURL
|
||||||
if case .lightweight = migrationType {
|
if case .lightweight = migrationType {
|
||||||
|
|
||||||
@@ -715,7 +724,6 @@ public extension DataStack {
|
|||||||
}
|
}
|
||||||
timerQueue.async(execute: recursiveCheck)
|
timerQueue.async(execute: recursiveCheck)
|
||||||
|
|
||||||
_ = try storage.cs_finalizeStorageAndWait(soureModelHint: sourceModel)
|
|
||||||
_ = try withExtendedLifetime(NSPersistentStoreCoordinator(managedObjectModel: destinationModel)) { (coordinator: NSPersistentStoreCoordinator) in
|
_ = try withExtendedLifetime(NSPersistentStoreCoordinator(managedObjectModel: destinationModel)) { (coordinator: NSPersistentStoreCoordinator) in
|
||||||
|
|
||||||
try coordinator.addPersistentStoreSynchronously(
|
try coordinator.addPersistentStoreSynchronously(
|
||||||
@@ -731,13 +739,13 @@ public extension DataStack {
|
|||||||
|
|
||||||
fakeProgress = 1
|
fakeProgress = 1
|
||||||
}
|
}
|
||||||
_ = try? storage.cs_finalizeStorageAndWait(soureModelHint: destinationModel)
|
try storage.cs_finalizeStorageAndWait(soureModelHint: destinationModel)
|
||||||
progress.completedUnitCount = progress.totalUnitCount
|
progress.completedUnitCount = progress.totalUnitCount
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|
||||||
// try manual migration
|
throw CoreStoreError(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +773,6 @@ public extension DataStack {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
try storage.cs_finalizeStorageAndWait(soureModelHint: sourceModel)
|
|
||||||
try migrationManager.migrateStore(
|
try migrationManager.migrateStore(
|
||||||
from: fileURL,
|
from: fileURL,
|
||||||
sourceType: type(of: storage).storeType,
|
sourceType: type(of: storage).storeType,
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ public final class SQLiteStore: LocalStorage {
|
|||||||
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
|
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
_ = try? FileManager.default.removeItem(atPath: "\(self.fileURL.path)-shm")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user