Disintegration of commonly used `details` attributes into individual columns in AuditEvents table
Problem to solve
We observed there are 13 different attributes used in the details
column in audit_events
table (ref).
Attribute List
- ip_address
- target_details
- entity_path
- target_id
- target_type
- author_name
- from
- to
- push_access_levels
- merge_access_levels
- as
- expiry_from
- expiry_to
The most commonly used attributes are:
Attribute | Usage % | Absolute usage value |
---|---|---|
ip_address |
100% | 55/55 |
target_details |
100% | 55/55 |
entity_path |
100% | 55/55 |
target_id |
95% | 52/55 |
target_type |
95% | 52/55 |
author_name |
76% | 42/55 |
Proposal
With this information, as a first step to Establish parallel persistence, we can extract the following attributes as independent columns in the audit_events
table:
ip_address
target_details
entity_path
target_id
target_type
author_name
Further details
Changes required:
- Migration to introduce new columns, with indexes
- Backfill existing data
- Route data writes to new columns. Continue populating to
details
(for a milestone) to ensure data correctness - Update data retrieval code to read from newly created columns
- Deprecate the attributes from
details
column