Skip to content

Commit 549eb75

Browse files
authored
Explicitly handle a custom ID key set to the empty string (#210)
* Add the composite ID benchmark tests. * Drop support for Swift 5.2 and 5.3 * Require current version of Fluent
1 parent 50ba00b commit 549eb75

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Diff for: Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.2
1+
// swift-tools-version:5.4
22
import PackageDescription
33

44
let package = Package(
@@ -10,7 +10,7 @@ let package = Package(
1010
.library(name: "FluentMySQLDriver", targets: ["FluentMySQLDriver"]),
1111
],
1212
dependencies: [
13-
.package(url: "https://github.com/vapor/fluent-kit.git", from: "1.24.0"),
13+
.package(url: "https://github.com/vapor/fluent-kit.git", from: "1.27.0"),
1414
.package(url: "https://github.com/vapor/mysql-kit.git", from: "4.0.0"),
1515
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
1616
],

Diff for: Sources/FluentMySQLDriver/FluentMySQLDatabase.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extension _FluentMySQLDatabase: Database {
2626
},
2727
onMetadata: { metadata in
2828
switch query.action {
29-
case .create:
29+
case .create where query.customIDKey != .string(""):
3030
let row = LastInsertRow(
3131
metadata: metadata,
3232
customIDKey: query.customIDKey

Diff for: Tests/FluentMySQLDriverTests/FluentMySQLDriverTests.swift

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ final class FluentMySQLDriverTests: XCTestCase {
1313
func testChildren() throws { try self.benchmarker.testChildren() }
1414
func testCodable() throws { try self.benchmarker.testCodable() }
1515
func testChunk() throws { try self.benchmarker.testChunk() }
16+
func testCompositeID() throws { try self.benchmarker.testCompositeID() }
1617
func testCRUD() throws { try self.benchmarker.testCRUD() }
1718
func testEagerLoad() throws { try self.benchmarker.testEagerLoad() }
1819
func testEnum() throws { try self.benchmarker.testEnum() }

0 commit comments

Comments
 (0)