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

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

Closed
haniyasin opened this issue Sep 21, 2023 · 0 comments · Fixed by #3355
Closed

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

haniyasin opened this issue Sep 21, 2023 · 0 comments · Fixed by #3355

Comments

@haniyasin
Copy link

haniyasin commented Sep 21, 2023

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

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

Successfully merging a pull request may close this issue.

1 participant