Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
linux-integration-sqlite:
if: ${{ !(github.event.pull_request.draft || false) }}
runs-on: ubuntu-latest
container: swift:5.10-jammy
container: swift:6.0-noble
steps:
- name: Check out package
uses: actions/checkout@v4
Expand All @@ -58,10 +58,10 @@ jobs:
linux-integration-mysql:
if: ${{ !(github.event.pull_request.draft || false) }}
runs-on: ubuntu-latest
container: swift:5.10-jammy
container: swift:6.0-noble
services:
mysql-a: { image: 'mysql:8', env: { MYSQL_ALLOW_EMPTY_PASSWORD: true, MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database } }
mysql-b: { image: 'mysql:8', env: { MYSQL_ALLOW_EMPTY_PASSWORD: true, MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database } }
mysql-a: { image: 'mysql:9', env: { MYSQL_ALLOW_EMPTY_PASSWORD: true, MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database } }
mysql-b: { image: 'mysql:9', env: { MYSQL_ALLOW_EMPTY_PASSWORD: true, MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database } }
steps:
- name: Check out package
uses: actions/checkout@v4
Expand All @@ -77,10 +77,10 @@ jobs:
linux-integration-psql:
if: ${{ !(github.event.pull_request.draft || false) }}
runs-on: ubuntu-latest
container: swift:5.10-jammy
container: swift:6.0-noble
services:
psql-a: { image: 'postgres:16', env: { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database, POSTGRES_HOST_AUTH_METHOD: scram-sha-256, POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 } }
psql-b: { image: 'postgres:16', env: { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database, POSTGRES_HOST_AUTH_METHOD: scram-sha-256, POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 } }
psql-a: { image: 'postgres:17', env: { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database, POSTGRES_HOST_AUTH_METHOD: scram-sha-256, POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 } }
psql-b: { image: 'postgres:17', env: { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database, POSTGRES_HOST_AUTH_METHOD: scram-sha-256, POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 } }
steps:
- name: Check out package
uses: actions/checkout@v4
Expand All @@ -96,7 +96,7 @@ jobs:
linux-integration-mongo:
if: ${{ !(github.event.pull_request.draft || false) }}
runs-on: ubuntu-latest
container: swift:5.10-jammy
container: swift:6.0-noble
services:
mongo-a: { image: 'mongo:6' }
mongo-b: { image: 'mongo:6' }
Expand All @@ -115,3 +115,6 @@ jobs:
unit-tests:
uses: vapor/ci/.github/workflows/run-unit-tests.yml@main
secrets: inherit
with:
with_musl: true
with_android: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<a href="LICENSE"><img src="https://design.vapor.codes/images/mitlicense.svg" alt="MIT License"></a>
<a href="https://github.com/vapor/fluent-kit/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/vapor/fluent-kit/test.yml?event=push&style=plastic&logo=github&label=tests&logoColor=%23ccc" alt="Continuous Integration"></a>
<a href="https://codecov.io/github/vapor/fluent-kit"><img src="https://img.shields.io/codecov/c/github/vapor/fluent-kit?style=plastic&logo=codecov&label=codecov"></a>
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift58up.svg" alt="Swift 5.8+"></a>
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift59up.svg" alt="Swift 5.9+"></a>
</p>

<br>
Expand Down
4 changes: 2 additions & 2 deletions Sources/FluentBenchmark/Tests/SchemaTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension FluentBenchmarker {
do {
try Category(name: "a").create(on: self.database).wait()
XCTFail("Duplicate save should have errored")
} catch let error as DatabaseError where error.isConstraintFailure {
} catch let error as any DatabaseError where error.isConstraintFailure {
// pass
}

Expand All @@ -61,7 +61,7 @@ extension FluentBenchmarker {
do {
try Category(name: "a").create(on: self.database).wait()
XCTFail("Duplicate save should have errored")
} catch let error as DatabaseError where error.isConstraintFailure {
} catch let error as any DatabaseError where error.isConstraintFailure {
// pass
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/FluentBenchmark/Tests/SoftDeleteTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ extension FluentBenchmarker {
)

// Delete all models
sleep(1)
Thread.sleep(forTimeInterval: 1.0)
try Trash.query(on: self.database).delete().wait()

// Make sure the `.deletedAt` value doesn't change.
Expand Down
2 changes: 1 addition & 1 deletion Sources/FluentBenchmark/Tests/UniqueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension FluentBenchmarker {
do {
try Foo(bar: "a", baz: 1).save(on: self.database).wait()
XCTFail("should have failed")
} catch let error where error is DatabaseError {
} catch let error where error is any DatabaseError {
// pass
}
}
Expand Down
3 changes: 3 additions & 0 deletions Sources/FluentKit/Docs.docc/theme-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"fluentkit": { "dark": "hsl(200, 75%, 85%)", "light": "hsl(200, 75%, 75%)" },
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-fluentkit) 30%, #000 100%)",
"documentation-intro-accent": "var(--color-fluentkit)",
"documentation-intro-eyebrow": "white",
"documentation-intro-figure": "white",
"documentation-intro-title": "white",
"logo-base": { "dark": "#fff", "light": "#000" },
"logo-shape": { "dark": "#000", "light": "#fff" },
"fill": { "dark": "#000", "light": "#fff" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public final class CompositeOptionalParentProperty<From, To>: @unchecked Sendabl
public subscript<Nested>(dynamicMember keyPath: KeyPath<To.IDValue, Nested>) -> Nested?
where Nested: Property
{
self.id?[keyPath: keyPath]
(self.id ?? To.IDValue())[keyPath: keyPath]
}
}

Expand Down
3 changes: 3 additions & 0 deletions Sources/FluentSQL/Docs.docc/theme-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"fluentkit": { "dark": "hsl(200, 75%, 85%)", "light": "hsl(200, 75%, 75%)" },
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-fluentkit) 30%, #000 100%)",
"documentation-intro-accent": "var(--color-fluentkit)",
"documentation-intro-eyebrow": "white",
"documentation-intro-figure": "white",
"documentation-intro-title": "white",
"logo-base": { "dark": "#fff", "light": "#000" },
"logo-shape": { "dark": "#000", "light": "#fff" },
"fill": { "dark": "#000", "light": "#fff" }
Expand Down
3 changes: 3 additions & 0 deletions Sources/XCTFluent/Docs.docc/theme-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"fluentkit": { "dark": "hsl(200, 75%, 85%)", "light": "hsl(200, 75%, 75%)" },
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-fluentkit) 30%, #000 100%)",
"documentation-intro-accent": "var(--color-fluentkit)",
"documentation-intro-eyebrow": "white",
"documentation-intro-figure": "white",
"documentation-intro-title": "white",
"logo-base": { "dark": "#fff", "light": "#000" },
"logo-shape": { "dark": "#000", "light": "#fff" },
"fill": { "dark": "#000", "light": "#fff" }
Expand Down
4 changes: 4 additions & 0 deletions Tests/FluentKitTests/CompositeIDTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ final class CompositeIDTests: XCTestCase {
let moon3_1 = try unjsonString(#"{"id":\#(moonJId),"name":"B","orbiting":{"id":{"normalizedOrdinal":1,"solarSystem":{"id":\#(sysJId)}}},"planetoid":{"id":{"normalizedOrdinal":1,"solarSystem":{"id":\#(sysJId)}},"name":"A"},"progenitor":{"id":null}}"#, as: CompositeMoon.self)
XCTAssertNilNil(moon3_1.$planetoid.value)
}

func testCompositeOptionalParentNestedKeyPathFieldKey() {
XCTAssertEqual(CompositeMoon()[keyPath: \.$progenitor.$normalizedOrdinal!.queryablePath][0].description, "nrm_ord")
}
}

fileprivate func XCTAssertNilNil<V>(_ expression: @autoclosure () throws -> Optional<Optional<V>>, _ message: @autoclosure () -> String = "", file: StaticString = #filePath, line: UInt = #line) {
Expand Down
5 changes: 4 additions & 1 deletion Tests/FluentKitTests/FluentKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,9 @@ final class FluentKitTests: XCTestCase {
XCTAssertEqual(db.sqlSerializers.count, 1)
XCTAssertEqual(db.sqlSerializers.first?.sql, #"INSERT INTO "foos" ("id", "opt") VALUES ($1, DEFAULT), ($2, NULL), ($3, $4)"#)
}


// Disabled because it doesn't really tell much of anything useful.
/*
func testFieldsPropertiesPerformance() throws {
measure {
let model = LotsOfFields()
Expand All @@ -801,6 +803,7 @@ final class FluentKitTests: XCTestCase {
}
}
}
*/
}

final class User: Model, @unchecked Sendable {
Expand Down
Loading