mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-11 07:32:57 +03:00
[PR #415] [MERGED] fix: ensure indexes on audit_logs table #823
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/415
Author: @ItalyPaleAle
Created: 4/4/2025
Status: ✅ Merged
Merged: 4/4/2025
Merged by: @kmendell
Base:
main← Head:audit-logs-indexes📝 Commits (4)
946243afix: ensure indexes on audit_logs tablec88e42dRemove unnecessary indexes0a4d0d2Merge branch 'main' into audit-logs-indexes99f9d1aMerge branch 'main' into audit-logs-indexes📊 Changes
9 files changed (+63 additions, -34 deletions)
View changed files
📝
backend/internal/controller/audit_log_controller.go(+3 -3)📝
backend/internal/model/audit_log.go(+9 -6)📝
backend/internal/model/oidc.go(+7 -4)📝
backend/internal/model/webauthn.go(+7 -5)📝
backend/internal/service/audit_log_service.go(+25 -16)➕
backend/resources/migrations/postgres/20250403082322_audit_logs_indexes.down.sql(+3 -0)➕
backend/resources/migrations/postgres/20250403082322_audit_logs_indexes.up.sql(+3 -0)➕
backend/resources/migrations/sqlite/20250403082322_audit_logs_indexes.down.sql(+3 -0)➕
backend/resources/migrations/sqlite/20250403082322_audit_logs_indexes.up.sql(+3 -0)📄 Description
The table had complex queries that in all cases were performing full-table scans, and in some cases were parsing each row's data as JSON. This ensures indexes are present on all columns that are used for querying, including on the
clientNameJSON property in the data columnAlso added passing context to the audit log methods which allows interrupting the long-running aggregate queries if the request is canceled (that is a small spin-off from #392 )
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.