Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function fastifyPostgres (fastify, options, next) {
}
}

client.query('BEGIN')
await client.query('BEGIN')
}

const onError = (req, reply, error, done) => {
Expand Down
8 changes: 4 additions & 4 deletions test/req-initialization.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('When we use the fastify-postgres transaction route option', t => {
connectionString
})

await fastify.pg.query('TRUNCATE users')
await fastify.pg.query('DELETE FROM "users" WHERE TRUE')

fastify.get('/count-users', async (req, reply) => {
const result = await fastify.pg.query('SELECT COUNT(*) AS "userCount" FROM users WHERE username=\'pass-opt-in\'')
Expand Down Expand Up @@ -49,7 +49,7 @@ test('When we use the fastify-postgres transaction route option', t => {
name: 'test'
})

await fastify.pg.test.query('TRUNCATE users')
await fastify.pg.test.query('DELETE FROM "users" WHERE TRUE')

fastify.get('/count-users', async (req, reply) => {
const result = await fastify.pg.test.query('SELECT COUNT(*) AS "userCount" FROM users WHERE username=\'pass-opt-in\'')
Expand Down Expand Up @@ -82,7 +82,7 @@ test('When we use the fastify-postgres transaction route option', t => {
connectionString
})

await fastify.pg.query('TRUNCATE users')
await fastify.pg.query('DELETE FROM "users" WHERE TRUE')

fastify.get('/count-users', async (req, reply) => {
const result = await fastify.pg.query('SELECT COUNT(*) AS "userCount" FROM users WHERE username=\'fail-opt-in\'')
Expand Down Expand Up @@ -117,7 +117,7 @@ test('When we use the fastify-postgres transaction route option', t => {
name: 'test'
})

await fastify.pg.test.query('TRUNCATE users')
await fastify.pg.test.query('DELETE FROM "users" WHERE TRUE')

fastify.get('/count-users', async (req, reply) => {
const result = await fastify.pg.test.query('SELECT COUNT(*) AS "userCount" FROM users WHERE username=\'fail-opt-in\'')
Expand Down