Skip to content

Migration and model for namespace filters for group destinations

What does this MR do and why?

  1. This MR adds a migration and model changes for supporting subgroup and project level filters for group level external audit event destinations.
  2. We are creating a NamespaceFilter model and corresponding which will be used for storing subgroup or project filters for a certain external audit event destination for streaming group level audit events.
  3. We are adding a limit of 1 such filter per destination as per requirement and the please note that the destinations can be added to top-level groups only.

Migrations

up

rake db:migrate:up:main VERSION=20231020095624

main: == [advisory_lock_connection] object_id: 178600, pg_backend_pid: 56320
main: == 20231020095624 CreateAuditEventsStreamingHttpGroupNamespaceFilters: migrating
main: -- create_table(:audit_events_streaming_http_group_namespace_filters)
main:    -> 0.0102s
main: == 20231020095624 CreateAuditEventsStreamingHttpGroupNamespaceFilters: migrated (0.1622s)

main: == [advisory_lock_connection] object_id: 178600, pg_backend_pid: 56320

down

rake db:migrate:down:main VERSION=20231020095624

main: == [advisory_lock_connection] object_id: 179400, pg_backend_pid: 55870
main: == 20231020095624 CreateAuditEventsStreamingHttpGroupNamespaceFilters: reverting
main: -- drop_table(:audit_events_streaming_http_group_namespace_filters)
main:    -> 0.0096s
main: == 20231020095624 CreateAuditEventsStreamingHttpGroupNamespaceFilters: reverted (0.0200s)

main: == [advisory_lock_connection] object_id: 179400, pg_backend_pid: 55870

Sample queries for usage of tables

Fetch the list of all namespace filters for a destination

select * from audit_events_streaming_http_group_namespace_filters where external_audit_event_destination_id = 6;

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #424173 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports