Skip to content

Releases: vapor/fluent-postgres-driver

Updated to use new PostgresKit/PostgresNIO APIs

09 May 16:01
8817a61

Choose a tag to compare

This patch was authored and released by @gwynne.

PostgresKit 2.11.0 heavily revamped PostgresKit to take full (or near to it) advantage of the modern PostgresNIO APIs. These changes do the same for FluentPostgresDriver, including adopting the revisions made to PostgresKit's API. This incidentally results in a significant improvement in the layering of the three packages, with FluentPostgresDriver now relying almost entirely on PostgresKit alone rather than needing to separately know details of PostgresNIO (with one or two exceptions). The end result is much cleaner code and moderate performance improvements.

Swift 5.7 or later is now required.

Users who previously specified custom PostgresDataEncoder and/or PostgresDataDecoder instances in their database configurations will begin receiving deprecation warnings; the replacements are PostgresNIO's PostgresEncodingContext and PostgresDecodingContext:

let postgresEncoder = PostgresDataEncoder(json: JSONEncoder()) // deprecated
let postgresEncodingContext = PostgresEncodingContext(jsonEncoder: JSONEncoder()) // new

let defaultPostgresEncoder = PostgresDataEncoder() // deprecated
let defaultPostgresEncodingContext = PostgresEncodingContext.default // new

let postgresDecoder = PostgresDataDecoder(json: JSONDecoder()) // deprecated
let postgresDecodingContext = PostgresDecodingContext(jsonDecoder: JSONDecoder()) // new

let defaultPostgresDecoder = PostgresDataDecoder() // deprecated
let defaultPostgresDecodingContext = PostgresDecodingContext.default // new

Update PostgresError's DatabaseError conformance for new PostgresNIO behavior

07 May 10:23
c7e3976

Choose a tag to compare

This patch was authored and released by @gwynne.

This makes DatabaseError.isSyntaxError and .isConstraintFailure work again.

Require PostgresKit 2.10.1 for CVE-2023-31136 fix

04 May 20:24
c7cd020

Choose a tag to compare

This patch was authored and released by @gwynne.

Update min Swift version to 5.6 and make platform versions consistent

14 Apr 01:01
afc0746

Choose a tag to compare

Update to match FluentKit's declared version minimums

20 Mar 07:07
f2b0844

Choose a tag to compare

This patch was authored and released by @gwynne.

This should help fix building in Xcode.

Update minimum Swift version to 5.5

27 Nov 02:51
4808c53

Choose a tag to compare

This patch was authored and released by @gwynne.

And a couple of minor cleanups to tests.

Add ability to control transactions

30 Jun 15:02
a8b2839

Choose a tag to compare

This patch was authored and released by @0xTim.

Adds the ability to control starting, committing and rolling back transactions outside of the main Fluent API. This could be used for setting up tests.

Since the new APIs give you manual control over a transaction, you should not use Database.transaction(_:) when using the manual transaction control. The inTransactionFlag will not be set when manually controlling a transaction

Warning: It is the users' responsibility to ensure the handle errors and rollback when necessary and commit transactions

Related to vapor/fluent-kit#520

Explicitly handle a custom ID key set to the empty string

13 Jun 16:14
5230817

Choose a tag to compare

This patch was authored and released by @gwynne.

Treat it as meaning not to retrieve an inserted ID value. This is in support of upcoming FluentKit feature work.

Clean up row decoding

18 Mar 21:22
7c266b5

Choose a tag to compare

This patch was authored and released by @gwynne.

Instead of duplicating logic implemented by postgres-kit for row decoding - and incorrectly, at that - we now always call through to that logic. Despite the additional indirection through the SQLRow existential, this should yield a minor improvement in performance, as we perform fewer unnecessary checks and retain fewer copies of data.

Note: Depends on vapor/postgres-kit#221 to receive the full benefit of these changes.

Fix logging of enum builder queries

18 Mar 15:03
33d502d

Choose a tag to compare

This patch was authored and released by @gwynne.

Queries issued for creation, updating, and dropping of enum types in databases which use custom data types for enumeration support (e.g. Postgres) were not being logged properly.