feat(backend): Add AuditLog database schema and migration

Implement AuditLog entity and EF Core configuration for Sprint 2 Story 1 Task 1.

Changes:
- Created AuditLog entity with multi-tenant support
- Added EF Core configuration with JSONB columns for PostgreSQL
- Created composite indexes for query optimization
- Generated database migration (20251104220842_AddAuditLogTable)
- Updated PMDbContext with AuditLog DbSet and query filter
- Updated task status to in_progress in sprint plan

Technical Details:
- PostgreSQL JSONB type for OldValues/NewValues (flexible schema)
- Composite index on (TenantId, EntityType, EntityId) for entity history queries
- Timestamp index (DESC) for recent logs queries
- UserId index for user activity tracking
- Multi-tenant query filter applied to AuditLog

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yaojia Wang
2025-11-04 23:10:12 +01:00
parent 5ba27f89b9
commit de6af53a77
7 changed files with 630 additions and 1 deletions

View File

@@ -1,9 +1,10 @@
---
task_id: sprint_2_story_1_task_1
story: sprint_2_story_1
status: not_started
status: in_progress
estimated_hours: 4
created_date: 2025-11-05
start_date: 2025-11-05
assignee: Backend Team
---