- Introduction
- Pitch
- Hogwarts
- Live Demo
- MVP
- Roadmap
- Launch Sprint
- PRD
- Get Started
- Localhost
- Architecture
- Structure
- Pattern
- Page
- Layout
- Content
- Types
- Config
- Actions
- Queries
- Authorization
- Validation
- Form
- Table
- Detail
- Card
- Util
- Hooks
- List Params
- Views
- README.md
- ISSUE.md
- Technology Stack
- Database
- File
- CDN Assets
- Entry Points
- Dashboard
- Authentication
- Credentials
- OAuth
- Flow Diagrams
- Multi-Tenancy
- Offline
- Onboarding
- Onboarding Videos
- Add Values
- Admission
- Application
- Attendance
- Compliance
- Profile
- Exams
- Exam Wizard
- Timetable
- Classrooms
- Notifications
- Conference
- LMS (Lumos)
- Finance
- Fee Management
- Invoice
- Wallet
- Salary
- Payroll
- Timesheet
- Expenses
- Budget
- Receipt
- Accounts
- Banking
- Reports
- Dashboard
- Permissions
- Messages
- Integration Flow
- Provision
- AI Document Processing
- Document Intelligence
- Internationalization
- Translation
- Translation Guide
- Icons
- Docs Factory
- Inspiration
- Listings
- Teachers
- Students
- Catalog
- Library
- Contributing
- Code of conduct
- GitHub Workflow
- Database Seeds
- Database Safety
- Test Accounts
- Playwright
- Prettier
- Block Rebound
Hogwarts is a multi-tenant SaaS — one database serves every school. A stray DROP TABLE, TRUNCATE, or unreviewed migration wipes data for every tenant. Protection is layered.
Active mechanisms
| Layer | Mechanism | Blocks |
|---|---|---|
| PreToolUse hook | Grep on every Bash command | migrate reset, db execute, accept-data-loss, DROP TABLE, TRUNCATE, DELETE FROM, ALTER TABLE...DROP |
| Permission deny list | Hard deny in settings.json | pnpm db:seed, prisma migrate reset, prisma db push --accept-data-loss, prisma db execute |
| Pre-commit seed check | Scans staged seed files | deleteMany, .delete(), TRUNCATE, DROP, $executeRaw |
ensure-demo.ts | Idempotent build script | Safe to repeat |
single.ts global flag | Skips school resolution for global seeds | Failure when schools table empty |
Seed system
Seeds split into global and school-scoped in prisma/seeds/single.ts.
Global (global: true) — populate platform-wide reference data:
| Seed | Description |
|---|---|
catalog | Global catalog (subjects, chapters, lessons) |
us | US K-12 catalog from the US-curriculum inventory |
school | Demo school + branding |
School-scoped — require demo school to exist (students, teachers, classes, attendance, etc.).
pnpm db:seed:single --list # List all seeds
pnpm db:seed:single catalog # Global seed (works on empty DB)
pnpm db:seed:single subjects # School-scoped seed (requires demo)
pnpm db:seed # BLOCKED — see belowWhy pnpm db:seed is blocked
The full seed runs every module sequentially and takes 45–120 minutes. Blocked because: it's slow and always times out in CI, it re-seeds foundations risking duplicates, and single-module seeding always suffices for development. Run it manually outside Claude Code only if you genuinely need a full reset.
Neon branch-before-touch
Before any schema change or operation that could affect existing data:
- Create a Neon branch (Neon MCP
create_branch). - Test the operation on the branch.
- If successful → apply to main.
- If failed → delete the branch — zero damage.
neon branches create --name "test-migration"
prisma migrate dev --create-only
cat prisma/migrations/<timestamp>/migration.sql # Review SQL
# If safe → apply to main. Else → neon branches delete "test-migration"Command reference
Safe (always allowed)
| Command | Purpose |
|---|---|
prisma generate | Regenerate Prisma client from schema |
prisma db push | Sync schema (no --accept-data-loss) |
prisma migrate dev --create-only | Generate migration SQL for review |
pnpm db:seed:single <name> | Seed one module |
pnpm db:seed:single --list | List available seeds |
Blocked
| Command | Why |
|---|---|
pnpm db:seed | Slow, full-DB risk |
prisma migrate reset | Drops entire database |
prisma db push --accept-data-loss | Drops tables with data |
prisma db execute | Raw SQL |
DROP TABLE / TRUNCATE | Destroys data |
DELETE FROM | Bulk row delete |
ALTER TABLE...DROP | Column drops |
Ask first
| Command | When |
|---|---|
prisma migrate dev | Create + apply migration (review SQL first) |
ALTER TABLE...ADD COLUMN | Adding columns is safe but confirm schema |
Recovery
Schema out of sync — prisma db push. Adds missing tables/columns without dropping data.
Missing tables —
prisma db push
pnpm db:seed:single school
pnpm db:seed:single authNeed a column — write targeted SQL:
ALTER TABLE "YourTable" ADD COLUMN IF NOT EXISTS "newColumn" TEXT;Accidental data loss — if a Neon branch existed before the operation, restore from it. Otherwise contact the team to restore from Neon's automatic backups.