Create a helper to create/update/delete new destination models in mutations
Create new ExternalStreamingDestination
models when any old ones are created.
When these models are created:
-
InstanceExternalAuditEventDestination
-ee/app/graphql/mutations/audit_events/instance_external_audit_event_destinations/create.rb
-
ExternalAuditEventDestination
-ee/app/graphql/mutations/audit_events/external_audit_event_destinations/create.rb
When creating destinations:
- Use the newly created helper to accomplish create, delete, update
- New models should have a
link
back to the original model (id
,category
composite key) - It should be behind the feature flag:
audit_events_external_destination_streamer_consolidation_refactor
When updating destinations:
- Find the associated model using the
_ref
column if possible, and update attributes - If there is no associated model, we do not create the associated model.
When deleting destinations:
- If the deleted destination exists in the associated model's table, delete it.
Reasoning:
- Did not want to create hooks in the db models as a strong dependency when deprecating the old models
- Make it easy to add/remove and use the feature flag
- When updating, we do not create models, as un-created destinations will be done through a migration.
Assumptions:
- Users will only interact with the models via API or UI
Doc: https://docs.google.com/document/d/1gOVM_gMQH-mmBCGaME8Ds1FVZkYgxscXQjq9CkGI5s8
Edited by Andrew Jung