Support first deploy database setup#74
Conversation
|
Warning Review limit reached
More reviews will be available in 37 minutes and 52 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 (2)
WalkthroughThis PR extends the 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
d31c400 to
cdf4b67
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/product/command-spec.md`:
- Around line 642-643: Clarify the second bullet so it explicitly limits the
"DIRECT_URL-only repair" behavior to preview branches: update the sentence that
starts "when only `DIRECT_URL` exists on the branch, explicit `--db` treats it
as partial setup and repairs the pair…" to say "when only `DIRECT_URL` exists on
a preview branch" (or similar) and ensure it references preview branches rather
than "the branch" so it cannot be read as applying to production; keep the first
bullet about production treating existing `DATABASE_URL`/`DIRECT_URL` as BYO
unchanged.
In `@packages/cli/tests/app-branch-database.test.ts`:
- Around line 674-778: The existing test covers the "both keys exist" BYO case
but misses the OR logic; add two new tests in
packages/cli/tests/app-branch-database.test.ts that mirror the current "deploy
--db treats existing production database env vars as BYO DB and leaves them
unchanged" test but where listEnvironmentVariables (used by the mocked preview
provider created in createPreviewAppProvider) returns only DATABASE_URL in one
test and only DIRECT_URL in the other; in each new test assert
createBranchDatabase/createEnvironmentVariable/updateEnvironmentVariable were
not called, deployApp was called, and result.result.branchDatabase equals {
status: "skipped", reason: "production-env-exists", envVars: ["DATABASE_URL"] }
or ["DIRECT_URL"] respectively, keeping the same mocks (requireComputeAuth,
deployApp) and calling runAppDeploy with db: true so the OR-condition is
covered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 19e8428a-557e-468c-9890-8573446b3c6c
📒 Files selected for processing (8)
docs/product/command-spec.mddocs/product/error-conventions.mddocs/product/resource-model.mdpackages/cli/src/commands/app/index.tspackages/cli/src/controllers/app.tspackages/cli/src/lib/app/branch-database-deploy.tspackages/cli/src/lib/app/production-deploy-gate.tspackages/cli/tests/app-branch-database.test.ts
AmanVarshney01
left a comment
There was a problem hiding this comment.
I checked the PR with create-prisma flow and it works great
Overview
Extends app deploy --db from preview-only branch databases to the first production deploy path, while keeping production guardrails around existing env vars and live deployments.
Changes
Why
This keeps the preview branch model and avoids managed bindings. Production setup only runs before the App has a live deployment, and any existing DB env var is treated as explicit BYO DB intent.
Validation