Overview
Hyperscape uses Drizzle ORM for database access:- Development: SQLite (zero config)
- Production: PostgreSQL
Schema Location
Database schema is defined in:Tables
Quest Tables
quest_progress - Tracks player quest state:Characters Table Schema
Thecharacters table stores all character data including skills:
prayerLevel/prayerXp— Prayer skill progressionprayerPoints— Current prayer points (0 to prayerLevel)prayerMaxPoints— Maximum prayer points (equals prayerLevel)activePrayers— JSON array of active prayer IDs (e.g.,'["thick_skin"]')
Prayer points are stored as integers in the database but tracked with fractional precision in-memory for accurate drain calculations.
Drizzle Commands
Run frompackages/server/:
Push Schema
Apply schema changes directly (development):Generate Migrations
Create migration files for changes:Run Migrations
Apply pending migrations:Studio
Open Drizzle Studio to browse data:Configuration
packages/server/drizzle.config.ts:
Development vs Production
Development (SQLite)
No configuration needed—uses local SQLite file:Production (PostgreSQL)
SetDATABASE_URL in environment:
Migrations
Migrations are stored inpackages/server/src/database/migrations/:
Recent Migrations
Migration Format
IF NOT EXISTS to be idempotent and safe to re-run. The --> statement-breakpoint comment is used by Drizzle to separate statements.
Migration Journal
Migrations must be registered inmeta/_journal.json to run:
The
activePrayers column stores a JSON array of prayer IDs. Format: '["thick_skin", "burst_of_strength"]'. Empty array when no prayers are active: '[]'.Schema Changes
1
Edit schema
Modify
packages/server/src/database/schema.ts2
Generate migration
3
Apply migration
4
Verify
Check that migration file was created in
src/database/migrations/