Skip to content

Commit

Permalink
Merge pull request #36 from cryptomator/feature/migrate-grdb-5-to-6
Browse files Browse the repository at this point in the history
Migrate from GRDB 5 to GRDB 6
  • Loading branch information
tobihagemann authored Sep 19, 2024
2 parents e08e0f2 + b864495 commit db2bfa4
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CryptomatorCloudAccess.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@
repositoryURL = "https://github.com/groue/GRDB.swift.git";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 5.26.0;
minimumVersion = 6.29.1;
};
};
74F93565251F6863001F4ADA /* XCRemoteSwiftPackageReference "promises" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/groue/GRDB.swift.git",
"state" : {
"revision" : "dd7e7f39e8e4d7a22d258d9809a882f914690b01",
"version" : "5.26.1"
"revision" : "2cf6c756e1e5ef6901ebae16576a7e4e4b834622",
"version" : "6.29.3"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/groue/GRDB.swift.git",
"state" : {
"revision" : "dd7e7f39e8e4d7a22d258d9809a882f914690b01",
"version" : "5.26.1"
"revision" : "2cf6c756e1e5ef6901ebae16576a7e4e4b834622",
"version" : "6.29.3"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let package = Package(
.package(url: "https://github.com/google/GTMAppAuth.git", .upToNextMinor(from: "4.0.0")),
.package(url: "https://github.com/google/gtm-session-fetcher.git", .upToNextMinor(from: "3.1.0")),
.package(url: "https://github.com/google/promises.git", .upToNextMinor(from: "2.3.0")),
.package(url: "https://github.com/groue/GRDB.swift.git", .upToNextMinor(from: "5.26.0")),
.package(url: "https://github.com/groue/GRDB.swift.git", .upToNextMinor(from: "6.29.1")),
.package(url: "https://github.com/openid/AppAuth-iOS.git", .upToNextMinor(from: "1.6.0")),
.package(url: "https://github.com/pCloud/pcloud-sdk-swift.git", .upToNextMinor(from: "3.2.0")),
.package(url: "https://github.com/phil1995/dropbox-sdk-obj-c-spm.git", .upToNextMinor(from: "7.2.0")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BoxIdentifierCache {
private let inMemoryDB: DatabaseQueue

init() throws {
self.inMemoryDB = DatabaseQueue()
self.inMemoryDB = try DatabaseQueue()
try inMemoryDB.write { db in
try db.create(table: BoxItem.databaseTableName) { table in
table.column(BoxItem.cloudPathKey, .text).notNull().primaryKey()
Expand Down
2 changes: 1 addition & 1 deletion Sources/CryptomatorCloudAccess/Box/BoxItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extension BoxItem {
}

extension BoxItem: PersistableRecord {
func encode(to container: inout PersistenceContainer) {
func encode(to container: inout PersistenceContainer) throws {
container[BoxItem.cloudPathKey] = cloudPath
container[BoxItem.identifierKey] = identifier
container[BoxItem.itemTypeKey] = itemType
Expand Down
4 changes: 2 additions & 2 deletions Sources/CryptomatorCloudAccess/Crypto/DirectoryIdCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private struct CachedEntry: Decodable, FetchableRecord, TableRecord {
}

extension CachedEntry: PersistableRecord {
func encode(to container: inout PersistenceContainer) {
func encode(to container: inout PersistenceContainer) throws {
container[CachedEntry.cleartextPathKey] = cleartextPath
container[CachedEntry.dirIdKey] = dirId
}
Expand All @@ -29,7 +29,7 @@ class DirectoryIdCache {
private let inMemoryDB: DatabaseQueue

init() throws {
self.inMemoryDB = DatabaseQueue()
self.inMemoryDB = try DatabaseQueue()
try inMemoryDB.write { db in
try db.create(table: CachedEntry.databaseTableName) { table in
table.column(CachedEntry.cleartextPathKey, .text).notNull().primaryKey()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private struct CachedEntry: Decodable, FetchableRecord, TableRecord {
}

extension CachedEntry: PersistableRecord {
func encode(to container: inout PersistenceContainer) {
func encode(to container: inout PersistenceContainer) throws {
container[CachedEntry.shortenedNameKey] = shortenedName
container[CachedEntry.originalNameKey] = originalName
}
Expand All @@ -48,7 +48,7 @@ class VaultFormat6ShortenedNameCache {
init(vaultPath: CloudPath) throws {
self.vaultPath = vaultPath
self.ciphertextNameCompIdx = vaultPath.pathComponents.lastItemIndex() + 4
self.inMemoryDB = DatabaseQueue()
self.inMemoryDB = try DatabaseQueue()
try inMemoryDB.write { db in
try db.create(table: CachedEntry.databaseTableName) { table in
table.column(CachedEntry.shortenedNameKey, .text).notNull().primaryKey()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private struct CachedEntry: Decodable, FetchableRecord, TableRecord {
}

extension CachedEntry: PersistableRecord {
func encode(to container: inout PersistenceContainer) {
func encode(to container: inout PersistenceContainer) throws {
container[CachedEntry.shortenedNameKey] = shortenedName
container[CachedEntry.originalNameKey] = originalName
}
Expand Down Expand Up @@ -106,7 +106,7 @@ class VaultFormat7ShortenedNameCache {
self.vaultPath = vaultPath
self.threshold = threshold
self.ciphertextNameCompIdx = vaultPath.pathComponents.lastItemIndex() + 4
self.inMemoryDB = DatabaseQueue()
self.inMemoryDB = try DatabaseQueue()
try inMemoryDB.write { db in
try db.create(table: CachedEntry.databaseTableName) { table in
table.column(CachedEntry.shortenedNameKey, .text).notNull().primaryKey()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GoogleDriveIdentifierCache {
private let inMemoryDB: DatabaseQueue

init() throws {
self.inMemoryDB = DatabaseQueue()
self.inMemoryDB = try DatabaseQueue()
try inMemoryDB.write { db in
try db.create(table: GoogleDriveItem.databaseTableName) { table in
table.column(GoogleDriveItem.cloudPathKey, .text).notNull().primaryKey()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class OneDriveIdentifierCache {
private let inMemoryDB: DatabaseQueue

init() throws {
self.inMemoryDB = DatabaseQueue()
self.inMemoryDB = try DatabaseQueue()
try inMemoryDB.write { db in
try db.create(table: OneDriveItem.databaseTableName) { table in
table.column(OneDriveItem.cloudPathKey, .text).notNull().primaryKey()
Expand Down
2 changes: 1 addition & 1 deletion Sources/CryptomatorCloudAccess/OneDrive/OneDriveItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct OneDriveItem: Decodable, FetchableRecord, TableRecord, Equatable {
}

extension OneDriveItem: PersistableRecord {
func encode(to container: inout PersistenceContainer) {
func encode(to container: inout PersistenceContainer) throws {
container[OneDriveItem.cloudPathKey] = cloudPath
container[OneDriveItem.identifierKey] = identifier
container[OneDriveItem.driveIdentifierKey] = driveIdentifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PCloudIdentifierCache {
private let inMemoryDB: DatabaseQueue

init() throws {
self.inMemoryDB = DatabaseQueue()
self.inMemoryDB = try DatabaseQueue()
try inMemoryDB.write { db in
try db.create(table: PCloudItem.databaseTableName) { table in
table.column(PCloudItem.cloudPathKey, .text).notNull().primaryKey()
Expand Down
2 changes: 1 addition & 1 deletion Sources/CryptomatorCloudAccess/PCloud/PCloudItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension PCloudItem {
}

extension PCloudItem: PersistableRecord {
func encode(to container: inout PersistenceContainer) {
func encode(to container: inout PersistenceContainer) throws {
container[PCloudItem.cloudPathKey] = cloudPath
container[PCloudItem.identifierKey] = identifier
container[PCloudItem.itemTypeKey] = itemType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DirectoryContentCacheTests: XCTestCase {
let subfolderPath = CloudPath("/subfolder")

override func setUpWithError() throws {
let inMemoryDB = DatabaseQueue()
let inMemoryDB = try DatabaseQueue()
cache = try DirectoryContentDBCache(dbWriter: inMemoryDB, maxPageSize: maxPageSize)
}

Expand Down

0 comments on commit db2bfa4

Please sign in to comment.