Assignment Count Database Trigger
Component Detail
Infrastructure
low complexity
backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations
Description
Supabase PostgreSQL database trigger that automatically increments the denormalized assignment count on the peer_mentors record whenever a new row is inserted into the assignments table. Ensures count consistency without requiring application-level aggregation.
assignment-count-trigger
Responsibilities
- Increment peer mentor assignment count on assignment insert
- Decrement count on assignment deletion or cancellation
- Maintain referential integrity between assignments and count fields
Interfaces
onAssignmentInsert()
onAssignmentDelete()
onAssignmentStatusChange()
Related Data Entities (3)
Data entities managed by this component