Skip to content

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:

  1. Remove not-null constraint on type column (!39192 (merged))
  2. Stop all writes to this field (!39082 (merged))
    • Replace all instances of SecurityEvent.create with AuditEvent.create
    • Overrides inheritance_column with an arbitrary field to cheat Rails into ignoring the type field
    • Mark this field as ignore_column
Edited by Tan Le