Vincit / objection.js

An SQL-friendly ORM for Node.js
https://vincit.github.io/objection.js
MIT License
7.26k stars 640 forks source link

Knex + objectionjs returns error when using insertGraph on mssql tables with trigger #2060

Closed meghamr1416 closed 3 years ago

meghamr1416 commented 3 years ago

Im using knex + objectionjs with Azure SQL database and I have a trigger in my main table to insert to audit table. When I try to use insertGraph on the table, it returns me the error "DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause".

I saw a resolution in knex for this to set includeTriggerModifications to true. But is there any option to set this to true using Objection? I want to use insertGraph since there are many related tables and not the knex.insert.

Any help would be appreciated.

Thanks!

koskimas commented 3 years ago

Objection uses knex. Just set the value for knex.

meghamr1416 commented 3 years ago

@koskimas I'm not sure if we can set the knex insert option in Objection's insertGraph.