AuditEvent: Stop using type column (step 1)
Problem to solve
The AuditEvent
model's type
column always has the same value: SecurityEvent
. That is useless information. Worse than useless, actually, because it's in one of the largest tables on gitlab.com so is adding unnecessary burden on resources there.
Further, the type
column is reserved by Rails for polymorphic models, and GitLab strongly discourages use of polymorphic models.
Proposal
Complete the beginning steps of the procedure for dropping columns:
- Remove not-null constraint on
type
column (!39192 (merged)) - Stop all writes to this field (!39082 (merged))
- Replace all instances of
SecurityEvent.create
withAuditEvent.create
- Overrides
inheritance_column
with an arbitrary field to cheat Rails into ignoring thetype
field - Mark this field as
ignore_column
- Replace all instances of
Edited by Tan Le