Skip to content

Commit d9b68c3

Browse files
authoredNov 4, 2021
Enable UPSERT support for MySQL (#299)
* Declare UPSERT support for MySQL, and correctly run the SQLKitBenchmark tests. * Quickie CI update
1 parent 529bde8 commit d9b68c3

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed
 

‎.github/workflows/test.yml

+14-10
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@ jobs:
2323
MYSQL_USER: vapor_username
2424
MYSQL_PASSWORD: vapor_password
2525
MYSQL_DATABASE: vapor_database
26-
container: swift:5.4-focal
26+
container: swift:5.5-focal
2727
strategy:
2828
fail-fast: false
2929
matrix:
3030
dbimage:
3131
- mysql:5.7
3232
- mysql:8.0
33-
- mariadb:latest
33+
- mariadb:10.2
34+
- mariadb:10.6
35+
- percona:5.7
36+
- percona:8.0
3437
dependent:
3538
- fluent-mysql-driver
3639
steps:
@@ -62,12 +65,13 @@ jobs:
6265
dbimage:
6366
- mysql:5.7
6467
- mysql:8.0
65-
- mariadb:latest
68+
- mariadb:10.2
69+
- mariadb:10.6
70+
- percona:5.7
71+
- percona:8.0
6672
runner:
6773
- swift:5.2-focal
68-
- swift:5.3-focal
69-
- swift:5.4-focal
70-
- swiftlang/swift:nightly-5.5-focal
74+
- swift:5.5-focal
7175
- swiftlang/swift:nightly-main-focal
7276
container: ${{ matrix.runner }}
7377
runs-on: ubuntu-latest
@@ -94,15 +98,15 @@ jobs:
9498
formula:
9599
- mysql@8.0
96100
- mysql@5.7
97-
- mariadb
101+
- percona-server
102+
- mariadb@10.6
98103
version:
99-
- latest
100104
- latest-stable
101105
include:
102106
- username: root
103-
- formula: mariadb
107+
- formula: mariadb@10.6
104108
username: runner
105-
runs-on: macos-latest
109+
runs-on: macos-11
106110
steps:
107111
- name: Select latest available Xcode
108112
uses: maxim-lobanov/setup-xcode@v1

‎Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
],
1212
dependencies: [
1313
.package(url: "https://github.com/vapor/mysql-nio.git", from: "1.0.0"),
14-
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.0.0"),
14+
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.12.0"),
1515
.package(url: "https://github.com/vapor/async-kit.git", from: "1.0.0"),
1616
.package(url: "https://github.com/apple/swift-crypto.git", from: "1.0.0"),
1717
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0"),

‎Sources/MySQLKit/MySQLDialect.swift

+4
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,8 @@ public struct MySQLDialect: SQLDialect {
6969
public var triggerSyntax: SQLTriggerSyntax {
7070
return .init(create: [.supportsBody, .conditionRequiresParentheses, .supportsOrder])
7171
}
72+
73+
public var upsertSyntax: SQLUpsertSyntax {
74+
.mysqlLike
75+
}
7276
}

‎Tests/MySQLKitTests/MySQLKitTests.swift

+2-10
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ import NIOSSL
66
import AsyncKit
77

88
class MySQLKitTests: XCTestCase {
9-
func testSQLKitBenchmark() throws {
10-
try self.benchmark.run()
11-
}
12-
13-
func testEnum() throws {
14-
try self.benchmark.testEnum()
9+
func testSQLBenchmark() throws {
10+
try SQLBenchmarker(on: self.sql).run()
1511
}
1612

1713
func testNullDecode() throws {
@@ -60,10 +56,6 @@ class MySQLKitTests: XCTestCase {
6056
self.pools.database(logger: .init(label: "codes.vapor.mysql"))
6157
}
6258

63-
var benchmark: SQLBenchmarker {
64-
.init(on: self.sql)
65-
}
66-
6759
var eventLoopGroup: EventLoopGroup!
6860
var pools: EventLoopGroupConnectionPool<MySQLConnectionSource>!
6961

0 commit comments

Comments
 (0)