Audit Trigger That Doesn't Fire For Alter Table, But Only For Dba Users
Hi i'm in this situation, i'm a DBA and every time i alter a table with a not null field adding a default value, the audit trigger writes my username all over the place (of course, poor guy's just doing his job). Problem is that our developers don't like having my name on the audit tables so i need to find a way to work around this situation...maybe changing the trigger with an if condition? create a second one that i activate everytime i do that kind of operation? Better ideas???
Answer
The first response is to change the trigger with an if
condition. If the powers-that-be don't care about NULL
-ability changes on columns, then they shouldn't be audited.
However, I don't really like that solution. The audit history tables exist for a reason. Perhaps there is something else going on, such as a notification going out when changes are made. If so, the logic for the notification should change rather than the audit tables.
This is something akin to warnings versus errors when compiling code. Changing NULL
-ability would still be in the audit tables so DBAs can see the full history of changes when they want to. That doesn't mean that they should be notified for every such change.
Note: this might require changing the trigger and adding a "priority level" or something similar to the audit table. This level can be used to set notifications.
Related Questions
- → I can't do a foreign key, constraint error
- → How to implement DbDongle::convertTimestamps as workaround of invalid timestamps with MySql strict
- → MySQL error "Foreign key constraint is incorrectly formed"
- → Eloquent Multitable query
- → "Laravel 5.1" add user and project with userId
- → Database backup with custom code in laravel 5 and get the data upto 10 rows from per table in database
- → Laravel 5.1 QueryException when trying to delete a project
- → Using Array in '->where()' for Laravel Query Building
- → Chaining "Count of Columns" of a Method to Single Query Builder
- → Laravel Eloquent Joining Strange query
- → convert time using mysql laravel 5
- → How to update a column after an expiration date in MySQL?
- → Foreign key constraint fails on existing key