Lucid: Truncate within transaction #1375
Answered
by
thetutlage
rbartholomay
asked this question in
Help
-
Ho can use truncate within transaction? I can´t set the ModelAdapterOptions when calling truncate() and everytime i get a pool error: Knex: Timeout acquiring await Database.transaction(async (trx) => {
await MyLucidModel.truncate() // <-- can´t set { client: trx } as an option here
await MyLucidModel.createMany(data, { client: trx })
}) Bye, René |
Beta Was this translation helpful? Give feedback.
Answered by
thetutlage
Jul 31, 2020
Replies: 1 comment 1 reply
-
Use this await Database.transaction(async (trx) => {
await trx.truncate(MyLucidModel.table)
await MyLucidModel.createMany(data, { client: trx })
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rbartholomay
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this