|
@@ -86,84 +86,6 @@ class NCManageDatabase: NSObject {
|
|
|
|
|
|
migrationBlock: { migration, oldSchemaVersion in
|
|
|
|
|
|
- if oldSchemaVersion < 61 {
|
|
|
- migration.deleteData(forType: tableShare.className())
|
|
|
- }
|
|
|
-
|
|
|
- if oldSchemaVersion < 74 {
|
|
|
- migration.enumerateObjects(ofType: tableLocalFile.className()) { oldObject, newObject in
|
|
|
- newObject!["ocId"] = oldObject!["fileID"]
|
|
|
- }
|
|
|
- migration.enumerateObjects(ofType: tableTrash.className()) { oldObject, newObject in
|
|
|
- newObject!["fileId"] = oldObject!["fileID"]
|
|
|
- }
|
|
|
- migration.enumerateObjects(ofType: tableTag.className()) { oldObject, newObject in
|
|
|
- newObject!["ocId"] = oldObject!["fileID"]
|
|
|
- }
|
|
|
- migration.enumerateObjects(ofType: tableE2eEncryptionLock.className()) { oldObject, newObject in
|
|
|
- newObject!["ocId"] = oldObject!["fileID"]
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if oldSchemaVersion < 87 {
|
|
|
- migration.deleteData(forType: tableActivity.className())
|
|
|
- migration.deleteData(forType: tableActivityPreview.className())
|
|
|
- migration.deleteData(forType: tableActivitySubjectRich.className())
|
|
|
- migration.deleteData(forType: tableExternalSites.className())
|
|
|
- migration.deleteData(forType: tableGPS.className())
|
|
|
- migration.deleteData(forType: tableTag.className())
|
|
|
- }
|
|
|
-
|
|
|
- if oldSchemaVersion < 120 {
|
|
|
- migration.deleteData(forType: tableCapabilities.className())
|
|
|
- migration.deleteData(forType: tableComments.className())
|
|
|
- }
|
|
|
-
|
|
|
- if oldSchemaVersion < 134 {
|
|
|
- migration.deleteData(forType: tableDirectEditingCreators.className())
|
|
|
- migration.deleteData(forType: tableDirectEditingEditors.className())
|
|
|
- migration.deleteData(forType: tableExternalSites.className())
|
|
|
- }
|
|
|
-
|
|
|
- if oldSchemaVersion < 141 {
|
|
|
- migration.enumerateObjects(ofType: tableAccount.className()) { oldObject, newObject in
|
|
|
- newObject!["urlBase"] = oldObject!["url"]
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if oldSchemaVersion < 162 {
|
|
|
- migration.enumerateObjects(ofType: tableAccount.className()) { oldObject, newObject in
|
|
|
- newObject!["userId"] = oldObject!["userID"]
|
|
|
- migration.deleteData(forType: tableMetadata.className())
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if oldSchemaVersion < 212 {
|
|
|
- migration.deleteData(forType: tableDirectory.className())
|
|
|
- migration.deleteData(forType: tableE2eEncryption.className())
|
|
|
- migration.deleteData(forType: tableE2eEncryptionLock.className())
|
|
|
- migration.deleteData(forType: tableMetadata.className())
|
|
|
- migration.deleteData(forType: tableShare.className())
|
|
|
- migration.deleteData(forType: tableTrash.className())
|
|
|
- migration.deleteData(forType: tableVideo.className())
|
|
|
- // Delete OLD avatar image
|
|
|
- if var pathUrl = CCUtility.getDirectoryGroup() {
|
|
|
- pathUrl.appendPathComponent(NCGlobal.shared.appUserData)
|
|
|
- do {
|
|
|
- let fileURLs = try FileManager.default.contentsOfDirectory(at: pathUrl, includingPropertiesForKeys: nil, options: .skipsHiddenFiles)
|
|
|
- for fileURL in fileURLs {
|
|
|
- try FileManager.default.removeItem(at: fileURL)
|
|
|
- }
|
|
|
- } catch { }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if oldSchemaVersion < 227 {
|
|
|
- migration.deleteData(forType: tableMetadata.className())
|
|
|
- migration.deleteData(forType: tableDirectory.className())
|
|
|
- migration.deleteData(forType: tableTrash.className())
|
|
|
- }
|
|
|
-
|
|
|
if oldSchemaVersion < 253 {
|
|
|
migration.deleteData(forType: tableActivity.className())
|
|
|
migration.deleteData(forType: tableActivityLatestId.className())
|