You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using diesel transactions, you need to use an individual postgres connection, rather than passing in an entire DB pool. This is a problem because some API actions, like comment creation, have many operations, and should be done in a transaction.
Currently, nearly all our functions in db_schema use the pool, rather than individual connections. So for the above example, we'd have to create nearly identical functions just for the PgConn versions.
Describe the solution you'd like.
Create a PoolOrConnection enum, and alter all the functions in db_schema to use it, instead of the pool.
Add a helper function to the enum, that if given a pool, extracts the connection, but if given a connection, just uses it.
Requirements
Is your proposal related to a problem?
When using diesel transactions, you need to use an individual postgres connection, rather than passing in an entire DB pool. This is a problem because some API actions, like comment creation, have many operations, and should be done in a transaction.
Currently, nearly all our functions in
db_schema
use the pool, rather than individual connections. So for the above example, we'd have to create nearly identical functions just for thePgConn
versions.Describe the solution you'd like.
Create a
PoolOrConnection
enum, and alter all the functions indb_schema
to use it, instead of the pool.Add a helper function to the enum, that if given a pool, extracts the connection, but if given a connection, just uses it.
Describe alternatives you've considered.
NA
Additional context
#4742
The text was updated successfully, but these errors were encountered: