Create consolidated group namespace filters table and model
As part of &12339, we need to add tables and models for namespace filters for group level external audit event destinations.
-
Already existing files for namespace filters for http destinations can be found at https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/audit_events/streaming/http/namespace_filter.rb, https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/audit_events/streaming/http/instance/namespace_filter.rb and https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/concerns/audit_events/streaming/http/namespace_filterable.rb.
-
Table schema would be:
create_table :audit_events_streaming_group_namespace_filters do |t|
t.timestamps_with_timezone null: false
t.references :external_streaming_destination,
null: false,
foreign_key: { to_table: 'audit_events_group_external_streaming_destinations', on_delete: :cascade }
t.references :namespace,
null: false,
foreign_key: { on_delete: :cascade }
t.index [:external_streaming_destination_id, :namespace_id], unique: true, name: UNIQ_INDEX_NAME
end
- Please create a model named
namespace_filter
in https://gitlab.com/gitlab-org/gitlab/-/tree/master/ee/app/models/audit_events/group directory. - Create a concern
namespace_filterable.rb
for having common code for model in this issue as well as for instance #436606 (closed). - For cells, sharding key would be
namespace_id
.
Edited by Hitesh Raghuvanshi