vapor / fluent-postgres-driver

🐘 PostgreSQL driver for Fluent.
MIT License
149 stars 53 forks source link

Add ability to control transactions #199

Closed 0xTim closed 2 years ago

0xTim commented 2 years ago

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

0xTim commented 2 years ago

The main issue here is going to be setting the inTransactionFlag if we care about it due to the database being a struct

VaporBot commented 2 years ago

These changes are now available in 2.4.0