diff --git a/Package.swift b/Package.swift index b51951a..5e99f78 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.8 +// swift-tools-version:5.9 import PackageDescription let package = Package( @@ -13,7 +13,7 @@ let package = Package( .library(name: "FluentSQLiteDriver", targets: ["FluentSQLiteDriver"]), ], dependencies: [ - .package(url: "https://github.com/vapor/fluent-kit.git", from: "1.48.4"), + .package(url: "https://github.com/vapor/fluent-kit.git", from: "1.49.0"), .package(url: "https://github.com/vapor/sqlite-kit.git", from: "4.5.1"), .package(url: "https://github.com/apple/swift-log.git", from: "1.5.4"), ], @@ -40,6 +40,9 @@ let package = Package( ) var swiftSettings: [SwiftSetting] { [ + .enableUpcomingFeature("ExistentialAny"), .enableUpcomingFeature("ConciseMagicFile"), .enableUpcomingFeature("ForwardTrailingClosures"), + .enableUpcomingFeature("DisableOutwardActorInference"), + .enableExperimentalFeature("StrictConcurrency=complete"), ] } diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift deleted file mode 100644 index 0db4a9d..0000000 --- a/Package@swift-5.9.swift +++ /dev/null @@ -1,48 +0,0 @@ -// swift-tools-version:5.9 -import PackageDescription - -let package = Package( - name: "fluent-sqlite-driver", - platforms: [ - .macOS(.v10_15), - .iOS(.v13), - .watchOS(.v6), - .tvOS(.v13), - ], - products: [ - .library(name: "FluentSQLiteDriver", targets: ["FluentSQLiteDriver"]), - ], - dependencies: [ - .package(url: "https://github.com/vapor/fluent-kit.git", from: "1.48.4"), - .package(url: "https://github.com/vapor/sqlite-kit.git", from: "4.5.1"), - .package(url: "https://github.com/apple/swift-log.git", from: "1.5.4"), - ], - targets: [ - .target( - name: "FluentSQLiteDriver", - dependencies: [ - .product(name: "FluentKit", package: "fluent-kit"), - .product(name: "FluentSQL", package: "fluent-kit"), - .product(name: "Logging", package: "swift-log"), - .product(name: "SQLiteKit", package: "sqlite-kit"), - ], - swiftSettings: swiftSettings - ), - .testTarget( - name: "FluentSQLiteDriverTests", - dependencies: [ - .product(name: "FluentBenchmark", package: "fluent-kit"), - .target(name: "FluentSQLiteDriver"), - ], - swiftSettings: swiftSettings - ), - ] -) - -var swiftSettings: [SwiftSetting] { [ - .enableUpcomingFeature("ExistentialAny"), - .enableUpcomingFeature("ConciseMagicFile"), - .enableUpcomingFeature("ForwardTrailingClosures"), - .enableUpcomingFeature("DisableOutwardActorInference"), - .enableExperimentalFeature("StrictConcurrency=complete"), -] } diff --git a/Sources/FluentSQLiteDriver/FluentSQLiteDriver.swift b/Sources/FluentSQLiteDriver/FluentSQLiteDriver.swift index 3a7e363..98e6330 100644 --- a/Sources/FluentSQLiteDriver/FluentSQLiteDriver.swift +++ b/Sources/FluentSQLiteDriver/FluentSQLiteDriver.swift @@ -29,6 +29,10 @@ struct FluentSQLiteDriver: DatabaseDriver { func shutdown() { try? self.pool.syncShutdownGracefully() } + + func shutdownAsync() async { + try? await self.pool.shutdownAsync() + } } struct ConnectionPoolSQLiteDatabase: SQLiteDatabase { diff --git a/Sources/FluentSQLiteDriver/SQLiteError+Database.swift b/Sources/FluentSQLiteDriver/SQLiteError+Database.swift index e810b8e..1b36a94 100644 --- a/Sources/FluentSQLiteDriver/SQLiteError+Database.swift +++ b/Sources/FluentSQLiteDriver/SQLiteError+Database.swift @@ -1,7 +1,8 @@ import SQLiteNIO import FluentKit -extension SQLiteError: DatabaseError { +// Required for Database Error +extension SQLiteError { public var isSyntaxError: Bool { switch self.reason { case .error, .schema: @@ -32,3 +33,9 @@ extension SQLiteError: DatabaseError { } } } + +#if compiler(<6) +extension SQLiteError: DatabaseError { } +#else +extension SQLiteError: @retroactive DatabaseError { } +#endif diff --git a/Tests/FluentSQLiteDriverTests/FluentSQLiteDriverTests.swift b/Tests/FluentSQLiteDriverTests/FluentSQLiteDriverTests.swift index a163aaf..d19f795 100644 --- a/Tests/FluentSQLiteDriverTests/FluentSQLiteDriverTests.swift +++ b/Tests/FluentSQLiteDriverTests/FluentSQLiteDriverTests.swift @@ -218,11 +218,11 @@ final class FluentSQLiteDriverTests: XCTestCase { self.dbs.use(.sqlite(.file(self.benchmarkPath)), as: .init(string: "benchmark")) self.database = self.dbs.database(.sqlite, logger: .init(label: "test.fluent.sqlite"), on: MultiThreadedEventLoopGroup.singleton.any()) } - - override func tearDownWithError() throws { - self.dbs.shutdown() + + override func tearDown() async throws { + await self.dbs.shutdownAsync() self.dbs = nil - try super.tearDownWithError() + try await super.tearDown() } }