Migrations
Prisma owns the migration workflow. Local development uses migrate dev. Production deploys use migrate deploy (wired
into deploy as a release / pre-deploy step).
Day-to-day commands
From the project root:
# Create a migration from schema changes and apply it locally (prisma migrate dev)
pnpm --filter @hype-stack/backend migration:create
# Apply committed migrations without prompting (prisma migrate deploy). CI and production
pnpm --filter @hype-stack/backend migration:latest
# Drop and rebuild the local database from the migrations
pnpm --filter @hype-stack/backend migration:reset
# Open Prisma Studio against your local database
pnpm --filter @hype-stack/backend exec prisma studioThe scripts live in apps/backend/package.json. deploy runs migration:latest as the release
step on Fly and Railway.
After installing a pack
compose and template drop each pack's .prisma files into apps/backend/prisma/schema/ and, when the packs added
models, offer to run prisma migrate dev right there. Packs ship models, never migrations, so the migration is
generated against your project's own history.
If you declined, or ran with --yes before the database was up:
- Inspect the merged schema under
apps/backend/prisma/schema/ - Run
pnpm --filter @hype-stack/backend migration:create - Confirm the generated client and Kysely types still typecheck
Skipping this step is the most common "tables do not exist" failure after adding auth, billing, or teams.
Seed data
When the project defines a seed script:
pnpm --filter @hype-stack/backend exec prisma db seedSeeds are for local and demo data. Do not treat seed SQL as the production source of truth for roles or tenants.
Staging and production discipline
Before a production deploy:
- Generate migrations intentionally on a feature branch
- Review the generated SQL
- Apply with
migrate deploy(or lethype-stack deploy webrun it) - Verify the app against the migrated schema
Never point a local migrate dev at a shared staging database. That command can reset and rewrite history.
Related
- Prisma and Kysely for when to use each tool
- Deploy for how Fly and Railway run migrations
- Going to production for the full checklist
- Troubleshooting if migrate cannot connect
Every purchase and sponsorship funds my 8+ years of work on open source given freely to the community. It keeps the lights on, funds new packs, and keeps the ecosystem alive. Even a small tier means a lot. Thank you!
