-
Notifications
You must be signed in to change notification settings - Fork 876
Add Encore guide #7466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Encore guide #7466
Conversation
WalkthroughA new guide document is added that provides step-by-step instructions for integrating Prisma ORM with Encore, covering setup, configuration, schema definition, API endpoints, migrations, and deployment. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@content/800-guides/460-encore.mdx`:
- Line 13: Change the phrase "open source backend framework" to the hyphenated
adjective form "open-source backend framework" in the sentence that references
Encore ("Prisma ORM provides type-safe database access, and Encore is an
open-source backend framework..."); update that exact phrase in content to
maintain grammatical correctness.
- Around line 94-97: The datasource currently sets url to env("SHADOW_DB_URL")
causing migrations to run against the shadow DB; change the datasource to point
url at your primary DB (e.g., env("DB_URL")) and add a separate
shadowDatabaseUrl set to env("SHADOW_DB_URL") so Prisma applies migrations to
the main DB while using the shadow DB only for migrate dev; update the
datasource block fields "url" and add "shadowDatabaseUrl" accordingly.
|
|
||
| ## Introduction | ||
|
|
||
| Prisma ORM provides type-safe database access, and [Encore](https://encore.dev) is an open source backend framework with built-in infrastructure automation and observability. Together, you get type-safe database queries with automatic database provisioning and migrations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hyphenate “open-source” when used as an adjective.
Minor grammar polish: “open-source backend framework.”
🧰 Tools
🪛 LanguageTool
[grammar] ~13-~13: Use a hyphen to join words.
Context: ... Encore is an open source backend framework with built-in i...
(QB_NEW_EN_HYPHEN)
🤖 Prompt for AI Agents
In `@content/800-guides/460-encore.mdx` at line 13, Change the phrase "open source
backend framework" to the hyphenated adjective form "open-source backend
framework" in the sentence that references Encore ("Prisma ORM provides
type-safe database access, and Encore is an open-source backend framework...");
update that exact phrase in content to maintain grammatical correctness.
| datasource db { | ||
| provider = "postgresql" | ||
| url = env("SHADOW_DB_URL") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Prisma datasource url shadowDatabaseUrl migrate dev behavior
💡 Result:
datasource db { url = ... }is the main/dev database connection Prisma uses to apply migrations when you runprisma migrate dev. [2]shadowDatabaseUrlis a separate database connection Prisma Migrate uses only duringmigrate dev(and somemigrate diffcases) to:- replay your existing migrations,
- detect schema drift,
- generate and validate the next migration (including data-loss checks). [1][2]
What changes when you set shadowDatabaseUrl:
- If you don’t set it, Prisma Migrate typically creates and drops a temporary shadow database automatically (requires privileges to create/drop databases). [1]
- If you do set
shadowDatabaseUrl, Prisma uses that pre-created shadow database and will reset/clean it at the start ofmigrate dev(and it is not dropped automatically afterward). [1]
Important behavior / safety:
- Never set
shadowDatabaseUrlto the same value asurl—you can wipe or reset the wrong database. [1] - In many cloud-hosted DB setups where creating/dropping databases isn’t allowed, you must manually create a dedicated shadow database and point
shadowDatabaseUrlat it. [1]
Related gotcha (often confused with shadow DB):
- If you use connection pooling (e.g., PgBouncer), Prisma recommends using
directUrlfor Migrate operations; Prisma Client usesurl, while Migrate can usedirectUrl. [7]
Sources: Prisma docs on shadow DB and migrate dev workflow. [1][2]
Use the main DB URL for datasource url and set shadowDatabaseUrl explicitly.
The schema currently points url to the shadow database. This causes migrations to apply against the shadow DB instead of your primary database, and leaves the actual DB_URL environment variable unused. In Prisma, url is where migrations are applied, while shadowDatabaseUrl is a separate database Prisma uses during migrate dev to detect schema drift and validate migrations safely. The correct pattern is to point url at your primary database and explicitly configure shadowDatabaseUrl for the shadow database.
✅ Suggested update
datasource db {
provider = "postgresql"
- url = env("SHADOW_DB_URL")
+ url = env("DB_URL")
+ shadowDatabaseUrl = env("SHADOW_DB_URL")
}🤖 Prompt for AI Agents
In `@content/800-guides/460-encore.mdx` around lines 94 - 97, The datasource
currently sets url to env("SHADOW_DB_URL") causing migrations to run against the
shadow DB; change the datasource to point url at your primary DB (e.g.,
env("DB_URL")) and add a separate shadowDatabaseUrl set to env("SHADOW_DB_URL")
so Prisma applies migrations to the main DB while using the shadow DB only for
migrate dev; update the datasource block fields "url" and add
"shadowDatabaseUrl" accordingly.
Adds a guide for using Prisma ORM with Encore under the guides section.
Encore is an open source backend framework for TypeScript with built-in infrastructure automation and observability.
The guide covers:
source: "prisma")Links to:
Summary by CodeRabbit
Documentation