feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 744 forks source link

ERROR: when feathersjs service create/post for MSSQL on a table with triggers #3278

Closed haniyasin closed 7 months ago

haniyasin commented 9 months ago

Steps to reproduce

Posting or Creating a record on service that uses KNEX and MSSQL & that table has triggers on insert will cause a 500 error The target table 'payrollemployees' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.", (First please check that this issue is not already solved as described here - if it is a general question or suggestion please start a Discussion)

Expected behavior

There are two solutions either to disable the triggers on all affected tables OR in knex Docs

// Adding the option includeTriggerModifications 
// allows you to run statements on tables 
// that contain triggers. Only affects MSSQL.
knex('books')
  .insert(
    {title: 'Alice in Wonderland'}, 
    ['id'], 
    { includeTriggerModifications: true }
  )

Tell us what should happen

i hope there is a way to include this { includeTriggerModifications: true } globally on driver level or at least service level instead of writing a custom service or disable triggers

PS: i think the problem propagates to other service methods but i did not test for that