25
CodeDev system / System reference
CodeDev database and data model
The current PostgreSQL/SQLAlchemy entities and the relationships that power projects, releases, media, leads, settings, analytics, users, and audit history.
01Persistent entities
| Model | Purpose |
|---|---|
| User | Admin identity, role, MFA/lockout/session-revocation state |
| Project | Public portfolio project and case-study fields |
| Release | Version/channel/status/download metadata tied to a project |
| Media | Uploaded image metadata and project ownership |
| Lead | Contact/inquiry records |
| SiteSetting | Key/value CMS presentation settings |
| AnalyticsEvent | Privacy-light server-side event counts/referrer domain |
| AuditLog | Privileged action history |
02Important relationships
- Project → Releases is one-to-many with delete-orphan cascade.
- Project → Media is one-to-many with delete-orphan cascade.
- Release(project_id, version) is unique per project.
- Project.slug and User.email are unique and indexed.
- Public-project indexes support published/build-area/featured/sort-order query patterns.
03State-change rule
Project/media workflows stage database changes and commit together. When upload validation/storage fails, the transaction is rolled back and already-stored media keys are cleaned up so the database does not claim a file was saved when the workflow failed.