Database Reference
Overview of the database schema and data model
Overview
Danvas uses PostgreSQL via Neon with Drizzle ORM for type-safe database access. The schema is split into domain modules under packages/database/src/schema/.
Technology
| Layer | Choice |
|---|---|
| Database | Neon PostgreSQL (serverless, branching) |
| ORM | Drizzle ORM with @neondatabase/serverless |
| Migrations | Drizzle Kit (drizzle-kit generate / drizzle-kit push) |
| Studio | Drizzle Studio (bun db:studio) at port 3005 |
Core Tables
| Table | Purpose |
|---|---|
teams | Restaurant groups (one per Clerk org) |
users | Staff members — linked to Clerk identities via clerkId |
locations | Restaurant locations — each team can have multiple |
server_reports | End-of-shift reports filed by staff (sales, ratings, notes) |
manager_reports | Daily manager reports with employee reviews |
incidents | Safety and operational incident reports |
management_schedules | Weekly schedules for managers and staff |
management_shifts | Individual shifts within a management schedule |
shift_task_definitions | Definitions for recurring shift tasks |
shift_task_instances | Specific instances of shift tasks to be completed |
compliance | Tracks whether staff have filed required reports |
forms | Custom form definitions (checklists, logs) |
form_submissions | Submitted form data |
messages | Internal team messages and board announcements |