Skip to content

Add explicit primary key definition to AuditEvent

Patrick Bair requested to merge 241267-specify-audit-events-primary-key into master

What does this MR do?

Related to #241267 (closed)

As a part of the change for partitioning audit_events, the AuditEvent model will need to have the primary key explicitly set to use only the id column.

While the database table also includes the partition key (created_at) in the primary key definition, due to Rails support for multi-column PK it's easier to simply use the id column, which should still be unique as it's backed by a sequence.

This change was originally part of !47581 (merged), but was decided to be split into a separate MR and released to prevent any issues with no-downtime deploys, see specifically this comment: !47581 (comment 457114294)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Patrick Bair

Merge request reports