auditor icon indicating copy to clipboard operation
auditor copied to clipboard

[DRAFT] Add support for Storing audit logs in a single table

Open ldaspt opened this issue 1 year ago • 1 comments

The goal is to allow storing all audit logs in a single table instead of creating a separate table for each audited entity.

I am aware of the performance issues that this can cause on an application with a large volume https://github.com/DATA-DOG/DataDogAuditBundle/issues/32

This PR is a work in progress to validate the design and approach.

I test the feature on the demo https://github.com/DamienHarper/auditor-bundle-demo by adding in config/services.yaml

    app.doctrine_single_table:
        class: DH\Auditor\Provider\Doctrine\Service\SingleTableDoctrineService
        decorates: dh_auditor.provider.doctrine.storage_services.doctrine.orm.default_entity_manager
        arguments: ['@.inner', 'audit']

Work Remaining:

  • [ ] Add tests to cover the new feature.
  • [ ] Modify schema structures to support a single audit table.
  • [ ] Update the Clean audit tables and Update audit tables commands to support this feature.
  • [ ] Enable the feature via the bundle configuration
  • [ ] Update the audit table property of the event payload

ldaspt avatar Dec 17 '24 11:12 ldaspt

Codecov Report

Attention: Patch coverage is 66.66667% with 24 lines in your changes missing coverage. Please review.

Project coverage is 95.59%. Comparing base (94e297d) to head (83f1363). Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
...er/Doctrine/Service/SingleTableDoctrineService.php 0.00% 24 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #235      +/-   ##
==========================================
- Coverage   97.15%   95.59%   -1.56%     
==========================================
  Files          42       43       +1     
  Lines        1721     1838     +117     
==========================================
+ Hits         1672     1757      +85     
- Misses         49       81      +32     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 10 '25 06:01 codecov[bot]