rushil1o1
rushil1o1
DTDrizzle Team
Created by rushil1o1 on 9/28/2023 in #help
WHERE clause on UNIQUE INDEX postgres does not generate the right migration statement
Re-ping: @Andrew Sherman -- is this a bug?'
3 replies
DTDrizzle Team
Created by rushil1o1 on 9/28/2023 in #help
WHERE clause on UNIQUE INDEX postgres does not generate the right migration statement
@Dan Kochetov : any ideas on this? Where clause is not generated in the generated SQL and is not reflected in the meta JSON file as well (which means it can't detect changes on it)
3 replies
DTDrizzle Team
Created by rushil1o1 on 9/13/2023 in #help
Any way to invoke a SQL function?
thank you!!
3 replies
DTDrizzle Team
Created by rushil1o1 on 8/8/2023 in #help
Suggestion: Add warning when adding breaking changes.
I believe Prisma has warnings like these --- not sure if these are already part of the roadmap
2 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 6/8/2023 in #help
Error when running drizzle-kit generate:mysql
That fixed it for me
5 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 6/8/2023 in #help
Error when running drizzle-kit generate:mysql
@coldhands : make sure you update your drizzle-kit as well
5 replies
DTDrizzle Team
Created by makaron pelnoziarnisty on 6/8/2023 in #help
Error when running drizzle-kit generate:mysql
+1 dealing with the same
5 replies
DTDrizzle Team
Created by rushil1o1 on 6/9/2023 in #help
Query from table with where clause NOT IN another sub query?
Here's what I'm trying:
const results = await db
.select({
...getTableColumns(employeeTable),
})
.from(employeeTable)
// .leftJoin(usersQuery, eq(employeeTable.workEmail, usersQuery.email)
.where(notInArray(employeeTable.workEmail, usersQuery))
.limit(limit);
const results = await db
.select({
...getTableColumns(employeeTable),
})
.from(employeeTable)
// .leftJoin(usersQuery, eq(employeeTable.workEmail, usersQuery.email)
.where(notInArray(employeeTable.workEmail, usersQuery))
.limit(limit);
3 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
Thanks @bloberenober !
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
It probably does but in this case we had some many back to back transactions that it eventually ran out of connections in the pool because none of them ever closed
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
@bloberenober --- doesn't look like drizzle releases the connection at the end of the transaction.
finally {
session.client.release();
}
finally {
session.client.release();
}
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
@bloberenober I doubt this has anything to do with the event loop --
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
export type TxClient = NodePgDatabase;
export async function execTx<T>(
fn: (client: TxClient) => Promise<T>
): Promise<T> {
let connection: PoolClient | undefined;
try {
connection = await pool.connect();
const txClient = drizzle(connection, { logger: new DrizzleLogger() });
await connection.query("BEGIN");
const result = await fn(txClient);
await connection.query("COMMIT");
return result;
} catch (err) {
logger.error(err, "Error executing transaction");
await connection?.query("ROLLBACK");
throw err;
} finally {
connection?.release();
}
}
export type TxClient = NodePgDatabase;
export async function execTx<T>(
fn: (client: TxClient) => Promise<T>
): Promise<T> {
let connection: PoolClient | undefined;
try {
connection = await pool.connect();
const txClient = drizzle(connection, { logger: new DrizzleLogger() });
await connection.query("BEGIN");
const result = await fn(txClient);
await connection.query("COMMIT");
return result;
} catch (err) {
logger.error(err, "Error executing transaction");
await connection?.query("ROLLBACK");
throw err;
} finally {
connection?.release();
}
}
Here's what we had before and it worked perfectly.
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
So I did some changes and debugging: I'm now sequentially running the seed script. My max parameter in the connection pool is now set to 1 I logged the number of transactions started and ended and now it only succeeds for ONE transaction and hangs after the first transaction. Does db.transaction() not release the connection from the pool before returning out of the API?
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
Here's our client right now
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
Do I need to explicitly close it after the transaction runs?
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
and its hanging and timing out after inserting around couple hundred rows
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
No - currently I'm testing this through vitest
36 replies
DTDrizzle Team
Created by rushil1o1 on 4/13/2023 in #help
[BUG?] Postgres transactions throwing connection timeouts after a lot of queries
is there an option to do that?
36 replies