Skip to content

Close or destroy connection #228

Answered by AndriiSherman
GerardKetuma asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @GerardKetuma!

Drizzle is not doing any connection pool destroy/create actions. You can do all of that in a driver you want to use with Drizzle
So for example node-postgres driver

const pool = new Pool({
  connectionString: 'postgres://user:password@host:port/db',
});
const db = drizzle(pool);
const allUsers = await db.select().from(users);
...
await pool.end() // Here you can use node-pg pool, that was created before db

https://node-postgres.com/apis/pool#poolend

So if driver you are using supports connection end then you can do the same as with node-postgres

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dankochetov
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants