feat(app): Support Prisma Next branch database setup#70
Conversation
|
Warning Review limit reached
More reviews will be available in 34 minutes and 40 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Overview
This extends branch database setup during app deploy so Prisma Next apps get the same database creation and schema setup path as Prisma ~7 apps. The deploy workflow can now apply schema from local code without adding a separate database command surface.
Changes
packages/cli/src/lib/app/branch-database.tsnow scans forprisma-next.config.*alongsideschema.prisma, classifies supported and unsupported database targets, and prefers Prisma Next configs when both sources exist.npx --no-install prisma-next contract emit --config <config>followed bynpx --no-install prisma-next db init --config <config> --db <database-url>. Prisma ORM keepsmigrate deploywhen migrations exist and usesdb pushotherwise.packages/cli/src/lib/app/branch-database-deploy.tsrejects explicit--dbfor known non-Postgres Prisma sources and suppresses automatic prompting for those unsupported sources. Schema setup errors now return recovery commands for the selected source.packages/cli/src/types/app.tsandpackages/cli/src/presenters/app.tscarry and render the schema source/command so deploy output and JSON can distinguish Prisma ORM from Prisma Next.packages/cli/tests/app-branch-database.test.tscovers the new command sequence, Prisma Next deploy setup, source precedence, unsupported targets, and the Prisma 7db pushcommand shape.docs/product/command-spec.md,docs/product/resource-model.md, anddocs/product/error-conventions.mddescribe the expanded schema-source contract.Why
Prisma Next does not use
schema.prismaas the deploy-time schema artifact, so the existing branch DB setup skipped schema application for those apps. Keeping this insideapp deploy --dbpreserves the current CLI/CI surface while letting the implementation choose the right local schema source. Known non-Postgres targets are rejected before database creation because this workflow creates Prisma Postgres databases and should not silently wire an incompatible branch database.