Adding active column to custom http audit event destination headers
What does this MR do and why?
- Adding a non null boolean column named
active
with default value astrue
to streaming headers tables for external audit event destinations. This column will be used for enabling and disabling the streaming headers. - Queries on this column will be made to fetch all the headers with value
true
for a destination. - Not adding an index on this column as there is a limit of 20 headers per external audit event destination, so I don't think that index is required here.
Database
As of 8th August 2023 10:13 GMT, there are total 145 rows in audit_events_streaming_headers
table and 0 rows in instance_audit_events_streaming_headers
table.
Migrations data
# up for audit_events_streaming_headers
RAILS_ENV=development bin/rails db:migrate:up:main VERSION=20230807101745
main: == [advisory_lock_connection] object_id: 224600, pg_backend_pid: 20490
main: == 20230807101745 AddActiveToAuditEventsStreamingHeaders: migrating ===========
main: -- add_column(:audit_events_streaming_headers, :active, :boolean, {:default=>true, :null=>false})
main: -> 0.0022s
main: == 20230807101745 AddActiveToAuditEventsStreamingHeaders: migrated (0.0058s) ==
main: == [advisory_lock_connection] object_id: 224600, pg_backend_pid: 20490
# down for audit_events_streaming_headers
RAILS_ENV=development bin/rails db:migrate:down:main VERSION=20230807101745
main: == [advisory_lock_connection] object_id: 224620, pg_backend_pid: 20019
main: == 20230807101745 AddActiveToAuditEventsStreamingHeaders: reverting ===========
main: -- remove_column(:audit_events_streaming_headers, :active, :boolean, {:default=>true, :null=>false})
main: -> 0.0019s
main: == 20230807101745 AddActiveToAuditEventsStreamingHeaders: reverted (0.0078s) ==
main: == [advisory_lock_connection] object_id: 224620, pg_backend_pid: 20019
===================================================================================================================
# up for instance_audit_events_streaming_headers
RAILS_ENV=development bin/rails db:migrate:up:main VERSION=20230807105131
main: == [advisory_lock_connection] object_id: 224600, pg_backend_pid: 19576
main: == 20230807105131 AddActiveToInstanceAuditEventsStreamingHeaders: migrating ===
main: -- add_column(:instance_audit_events_streaming_headers, :active, :boolean, {:default=>true, :null=>false})
main: -> 0.0047s
main: == 20230807105131 AddActiveToInstanceAuditEventsStreamingHeaders: migrated (0.0085s)
main: == [advisory_lock_connection] object_id: 224600, pg_backend_pid: 19576
# down for instance_audit_events_streaming_headers
RAILS_ENV=development bin/rails db:migrate:down:main VERSION=20230807105131
main: == [advisory_lock_connection] object_id: 224640, pg_backend_pid: 19107
main: == 20230807105131 AddActiveToInstanceAuditEventsStreamingHeaders: reverting ===
main: -- remove_column(:instance_audit_events_streaming_headers, :active, :boolean, {:default=>true, :null=>false})
main: -> 0.0051s
main: == 20230807105131 AddActiveToInstanceAuditEventsStreamingHeaders: reverted (0.0107s)
main: == [advisory_lock_connection] object_id: 224640, pg_backend_pid: 19107
How to set up and validate locally
- Run the migrations.
- Open psql by running
gdk psql
. - Run
\d instance_audit_events_streaming_headers;
, output would be something like following, noticeactive
column details: - Run
\d audit_events_streaming_headers;
, output would be as follows, again noticeactive
column details:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #367509 (closed)
Edited by Hitesh Raghuvanshi