Skip to content

Add audit schema and triggers for API tables#218

Merged
edulauer merged 6 commits intomainfrom
issue-216
Aug 5, 2025
Merged

Add audit schema and triggers for API tables#218
edulauer merged 6 commits intomainfrom
issue-216

Conversation

@edulauer
Copy link
Member

Fix #216

  • Create a function to set up the audit schema and table
  • Add triggers to API tables to log inserts, updates, and deletes in all api tables
  • Set the default value of TEST_ENVIRONMENT to true in the Docker Compose file

Copy link
Member

@augusto-herrmann augusto-herrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

Wouldn't it be better if it had a separate flag in an environment variable (not just TEST_ENVIRONMENT), so that when installing the system one could choose whether or not they want the audit log? This ought to grow data storage pretty fast, and it seems reasonable that in some deployments it may not be desirable to keep those logs.

@edulauer
Copy link
Member Author

edulauer commented Aug 5, 2025

Good job!

Wouldn't it be better if it had a separate flag in an environment variable (not just TEST_ENVIRONMENT), so that when installing the system one could choose whether or not they want the audit log? This ought to grow data storage pretty fast, and it seems reasonable that in some deployments it may not be desirable to keep those logs.

Good point @augusto-herrmann. I made some changes to use a new environment variable. In case the user disable it, will also remove the triggers to stop populating the database

Copy link
Member

@augusto-herrmann augusto-herrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, remove_audit_triggers is necessary to allow the audit log setting to be disabled or re-enabled at will.

@edulauer edulauer merged commit 21ba7f4 into main Aug 5, 2025
1 check passed
@edulauer edulauer deleted the issue-216 branch August 5, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Criar log de auditoria do banco

2 participants