Skip to content

Added migration and models for instance external audit events

What does this MR do and why?

Relates to #335175 (closed)

We have a feature for sending audit events to external destinations for Ultimate users. This is being done on group level. Now we are planning on introducing the same on instance level. For doing this we need to first store the external destination urls on instance level.

Code changes:

  1. The changes will require a new table for storing the destinations information and APIs for interacting with them. In this MR, we are adding the table and the model relevant to it. API changes will be added in a follow up MR.
  2. Since the group level and instance level external destinations have many things in common, so a new abstract model class is created BaseExternalAuditEventDestination and the respective model classes for group and instance will inherit this class.
  3. The new table being introduced is audit_events_instance_external_audit_event_destinations.

Database Review

Migrate up

RAILS_ENV=development bin/rails db:migrate:up:main VERSION=20230406060452
main: == 20230406060452 CreateInstanceExternalAuditEventDestinations: migrating =====
main: -- create_table(:audit_events_instance_external_audit_event_destinations)
main: -- quote_column_name(:destination_url)
main:    -> 0.0000s
main: -- quote_column_name(:verification_token)
main:    -> 0.0000s
main:    -> 0.0067s
main: == 20230406060452 CreateInstanceExternalAuditEventDestinations: migrated (0.1045s)

Migrate down

RAILS_ENV=development bin/rails db:migrate:down:main VERSION=20230406060452
main: == 20230406060452 CreateInstanceExternalAuditEventDestinations: reverting =====
main: -- drop_table(:audit_events_instance_external_audit_event_destinations)
main:    -> 0.0027s
main: == 20230406060452 CreateInstanceExternalAuditEventDestinations: reverted (0.0146s)

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 #335175 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports