ersindeniz
Explore posts from serversDTDrizzle Team
•Created by ersindeniz on 12/31/2024 in #help
How to Use db.query to Access Transaction Data in Drizzle ORM When Using Connection Pool?
In Drizzle ORM, I was using createConnection and performing transactions with trx.create. After creating the transaction, I could use db.query to retrieve the data created within the transaction without any issues.
However, after switching to createPool, the same approach doesn’t work. Specifically:
After trx.create, the subsequent db.query calls cannot access the data created within the transaction.
How can I configure the transaction or connection pool so that I can query the data created during the transaction using db.query?
Additional Context:
Why am I using db.query instead of trx.query?
In my transaction callback, I am using certain functions that interact with the database using db.query instead of trx.query. These functions require direct access to the database connection (db.query), which is why I cannot use trx.query within them.
This might not be the best approach, but the architecture was designed this way, and refactoring it seems costly at the moment.
1 replies
TTCTheo's Typesafe Cult
•Created by ersindeniz on 9/21/2024 in #questions
T3 Stack for Large-Scale Project: Pros and Cons?
Would you prefer using a T3 app for a full-stack project with numerous tables and numerous CRUD operations? As you know, T3 has a monorepo architecture. I've read some things about monorepos slowing down the TS server as they grow. I'm using Drizzle and exporting select and insert types for each table. I'm also creating Zod schemas for all endpoints and inferring and exporting types for all these schemas.
Since I'm at the beginning of the project, I welcome any suggestions you might have.
4 replies