Skip to content

Commit

Permalink
Update to alpha-1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Jan 22, 2024
1 parent a7df20c commit cf9e51c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 44 deletions.
3 changes: 1 addition & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-async-algorithms.git", from: "1.0.0"),
.package(url: "https://github.com/hummingbird-project/hummingbird.git", branch: "2.x.x"),
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-alpha.1"),
.package(url: "https://github.com/vapor/fluent-kit.git", from: "1.45.1"),
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"),
// used in tests
Expand All @@ -29,7 +29,6 @@ let package = Package(
.product(name: "FluentSQLiteDriver", package: "fluent-sqlite-driver"),
.product(name: "FluentPostgresDriver", package: "fluent-postgres-driver"),
.byName(name: "HummingbirdFluent"),
.product(name: "HummingbirdFoundation", package: "hummingbird"),
.product(name: "HummingbirdXCT", package: "hummingbird"),
]),
]
Expand Down
2 changes: 1 addition & 1 deletion Sources/HummingbirdFluent/Fluent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Hummingbird server framework project
//
// Copyright (c) 2021-2023 the Hummingbird authors
// Copyright (c) 2021-2024 the Hummingbird authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand Down
2 changes: 1 addition & 1 deletion Sources/HummingbirdFluent/Persist+fluent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Hummingbird server framework project
//
// Copyright (c) 2021-2021 the Hummingbird authors
// Copyright (c) 2021-2024 the Hummingbird authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand Down
21 changes: 0 additions & 21 deletions Sources/HummingbirdFluent/UUID.swift

This file was deleted.

19 changes: 15 additions & 4 deletions Tests/HummingbirdFluentTests/FluentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Hummingbird server framework project
//
// Copyright (c) 2021-2021 the Hummingbird authors
// Copyright (c) 2021-2024 the Hummingbird authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand Down Expand Up @@ -73,16 +73,27 @@ final class FluentTests: XCTestCase {
)
// add sqlite database
fluent.databases.use(.sqlite(.memory), as: .sqlite)
// fluent.databases.use(.postgres(hostname: "localhost", username: "postgres", password: "vapor", database: "vapor"), as: .psql)
/* fluent.databases.use(
.postgres(
configuration: .init(
hostname: "localhost",
port: 5432,
username: "hummingbird",
password: "hummingbird",
database: "hummingbird", tls: .disable
),
maxConnectionsPerEventLoop: 32
),
as: .psql
) */
// add migration
await fluent.migrations.add(CreatePlanet())
// run migrations
try await fluent.migrate()

let router = HBRouter()
router.middlewares.add(HBSetCodableMiddleware(decoder: JSONDecoder(), encoder: JSONEncoder()))
router.put("planet") { request, context in
let planet = try await request.decode(as: Planet.self, using: context)
let planet = try await request.decode(as: Planet.self, context: context)
try await planet.create(on: fluent.db())
return CreateResponse(id: planet.id!)
}
Expand Down
30 changes: 15 additions & 15 deletions Tests/HummingbirdFluentTests/PersistTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Hummingbird server framework project
//
// Copyright (c) 2021-2021 the Hummingbird authors
// Copyright (c) 2021-2024 the Hummingbird authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -24,20 +24,20 @@ final class PersistTests: XCTestCase {
logger.logLevel = .trace
let fluent = HBFluent(logger: logger)
// add sqlite database
// fluent.databases.use(.sqlite(.memory), as: .sqlite)
fluent.databases.use(
.postgres(
configuration: .init(
hostname: "localhost",
port: 5432,
username: "hummingbird",
password: "hummingbird",
database: "hummingbird", tls: .disable
),
maxConnectionsPerEventLoop: 32
),
as: .psql
)
fluent.databases.use(.sqlite(.memory), as: .sqlite)
/* fluent.databases.use(
.postgres(
configuration: .init(
hostname: "localhost",
port: 5432,
username: "hummingbird",
password: "hummingbird",
database: "hummingbird", tls: .disable
),
maxConnectionsPerEventLoop: 32
),
as: .psql
) */
let persist = await HBFluentPersistDriver(fluent: fluent)
// run migrations
try await fluent.migrate()
Expand Down

0 comments on commit cf9e51c

Please sign in to comment.