Skip to content

AuditEvent model for ClickHouse database

Harsimar Sandhu requested to merge 422452-audit-events-clickhouse-model into master

What does this MR do and why?

AuditEvent model for ClickHouse database

This commit adds a model for audit events to interact with ClickHouse database

We're doing this to continue using filtering similar to how we do with ActiveRecord. It helps us keep our filtering methods the same.

Changelog: added

How to set up and validate locally

  1. You can test using rails console
[16] pry(main)> ClickHouse::Models::AuditEvent.by_entity_type("Project").to_sql
"SELECT * FROM \"audit_events\" WHERE \"audit_events\".\"entity_type\" = 'Project'"
[17] pry(main)> ClickHouse::Models::AuditEvent.by_entity_type("Project").by_entity_id(1).to_sql
"SELECT * FROM \"audit_events\" WHERE \"audit_events\".\"entity_type\" = 'Project' AND \"audit_events\".\"entity_id\" = 1"

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

Edited by Harsimar Sandhu

Merge request reports

Loading