Database
THE HCLAB uses Prisma 6 with PostgreSQL. The schema lives in prisma/schema.prisma.
Sync schema
After cloning or pulling schema changes:
npx prisma generate # regenerate client (also runs on npm install)
npx prisma db push # apply schema to DATABASE_URL
For production, run db push (or migrations) against the production database before deploying app code that depends on new columns.
Seed data
npm run db:seed
The seed creates:
- Content categories and sample frameworks/articles
- Admin user
lab@thehclab.com - Researcher user
researcher@thehclab.com - Optional PFDF study template and demo participants (when seed modules run)
Prisma Studio
Browse and edit rows visually:
npm run db:studio
Common models
| Area | Key models |
|---|---|
| Content | Article, Framework, Category, Resource, PodcastEpisode |
| Learning | LearningPath, Assessment, Certification |
| Accounts | User, Bookmark, Download |
| Research | Study, Participant, TaskResponse, StudyExport |
| Commerce | Stripe fields on User, LearningPathPurchase |
User name fields
Users store title, firstName, and lastName. The name column is a synced full display name used in emails and exports.
Troubleshooting
Column does not exist — run npx prisma db push against the database your app is using.
Seed fails on unique constraint — seed uses upserts; check for manual schema drift or partial migrations.