Main Schema
Complete database schema for NPP Portal
Main Database Schema
This ERD shows all entities and relationships in the NPP Portal database, organized into four domains.
Loading...
Design Decisions
Soft Deletes
All entities use active: BOOLEAN instead of hard deletes:
- Preserves historical data
- Maintains referential integrity
- Allows recovery of accidentally deleted records
JSONB for Flexible Data
activity_details.additional_details uses PostgreSQL JSONB:
- Different activity types may have different extra fields
- Avoids schema changes for new activity type attributes
- Queryable with PostgreSQL JSON operators
UUID for External References
users.uuid provides a stable external identifier:
- Primary key
idis internal only - UUID used in API responses and URLs
- Prevents enumeration attacks
Indexes
| Table | Index | Purpose |
|---|---|---|
users | idx_user_login | Login lookup |
users | idx_user_email | Email lookup |
users | idx_user_uuid | API lookups |
activities | idx_activity_year_semester | Period filtering |
activities | idx_activity_works_type | Type filtering |
departments | idx_department_faculty_active | Faculty lookup |