Reputation: 1649
When deploying SQL Server Database projects (using either the SSDT Publish wizard or DACPAC deployment), the automated SQL scripts starts by disabling all triggers.
How do I avoid this?
And what are the side effects of not disabling triggers?
PRINT N'Disabling all DDL triggers...'
GO
DISABLE TRIGGER ALL ON DATABASE
GO
<ALL DB CHANGES>
GO
PRINT N'Reenabling DDL triggers...'
GO
ENABLE TRIGGER [LogSchemaChanges] ON DATABASE
GO
PRINT N'Update complete.';
Why would I do this? We have a trigger that logs all schema changes to an audit log. ...and Isn't it ironic, don't you think...
Upvotes: 3
Views: 1521
Reputation: 1649
For manual Publish Wizard deployment, change the behaviour under:
For automated DACPAC deployment via SQLPackage, set the following publish property:
/p:DisableAndReenableDdlTriggers=False
Specifies whether Data Definition Language (DDL) triggers are disabled at the beginning of the publish process and re-enabled at the end of the publish action.
Upvotes: 4