Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database.transaction is not defined #184

Closed
radmen opened this issue Oct 5, 2017 · 2 comments
Closed

Database.transaction is not defined #184

radmen opened this issue Oct 5, 2017 · 2 comments

Comments

@radmen
Copy link
Contributor

radmen commented Oct 5, 2017

According to docs, this code should be valid:

await Database.transaction(async (trx) => {
  await trx.insert({username: 'virk'}).into('users')
})

However, method transaction() is not defined.

@radmen
Copy link
Contributor Author

radmen commented Oct 5, 2017

Fortunately there's a simple workaround:

const { knex } = Database.connection()

await knex.transaction(async (trx) => {
  await trx.insert({username: 'virk'}).into('users')
})

@thetutlage
Copy link
Member

Weird, should have worked. Will look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants