fix: Use db-deploy instead of db-migrate for yarn dx in non-interacti…#23253
Conversation
…ve environments Fixes the issue where 'yarn dx' fails in non-interactive environments (CI/CD, Docker, automated scripts) by changing Turbo dependencies: - @calcom/prisma#db-seed: db-migrate → db-deploy - @calcom/prisma#dx: db-migrate → db-up This ensures that non-interactive 'prisma migrate deploy' is used instead of interactive 'prisma migrate dev', allowing yarn dx to work correctly in automated environments. Resolves: Cal.com App Store performance optimization - yarn dx failure
|
@Vansh5632 is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe PR updates turbo.json pipeline dependencies for Prisma tasks. Specifically, @calcom/prisma#db-seed now depends on @calcom/prisma#db-deploy instead of @calcom/prisma#db-migrate, and @calcom/prisma#dx now depends on @calcom/prisma#db-up instead of @calcom/prisma#db-migrate. No other pipeline entries or exported/public entities are changed. Assessment against linked issues
Possibly related PRs
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
turbo.json(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (1)
turbo.json (1)
21-23: No changes needed:dxalready includes non-interactive migrationsA look at
packages/prisma/package.jsonshows:
dxrunsyarn db-setupdb-setuprunsdb-up, thendb-deploy(yarn prisma migrate deploy), thendb-seedSince
dxinvokesdb-deployunder the hood, it already performs non-interactive migrations. You don’t need to add@calcom/prisma#db-deployto thedependsOnlist inturbo.json.
turbo.json
Outdated
| "@calcom/prisma#db-seed": { | ||
| "cache": false, | ||
| "dependsOn": ["@calcom/prisma#db-migrate"] | ||
| "dependsOn": ["@calcom/prisma#db-deploy"] | ||
| }, |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Restore transitive "DB up → deploy → seed" ordering to avoid race/failures
By switching @calcom/prisma#db-seed to depend on @calcom/prisma#db-deploy, we lost the previous transitive dependency on @calcom/prisma#db-up that existed via db-migrate (which depended on db-up, Line 10). Any target that depends on @calcom/prisma#db-seed (e.g., embed-tests-update-snapshots:ci at Lines 225–231) may now run seeding without the DB being up unless the db-deploy script itself ensures that. That’s a subtle regression risk in CI and fresh local setups.
Two safe options:
- Preferred: Make
@calcom/prisma#db-deploydepend on@calcom/prisma#db-upto preserve the original ordering for all callers.
+ "@calcom/prisma#db-deploy": {
+ "cache": false,
+ "dependsOn": ["@calcom/prisma#db-up"],
+ "inputs": ["./migrations/**/*.sql", "./prisma/migrations/**/*.sql"]
+ },- Minimal: Also include
@calcom/prisma#db-upalongside@calcom/prisma#db-deployfordb-seed.
- "dependsOn": ["@calcom/prisma#db-deploy"]
+ "dependsOn": ["@calcom/prisma#db-up", "@calcom/prisma#db-deploy"]Run this to confirm the scripts exist in the @calcom/prisma package and that db-deploy does not already take care of db-up:
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
echo "== Locate @calcom/prisma package.json =="
fd -a -H -t f package.json | rg -nC2 '"name"\s*:\s*"@calcom/prisma"' | sed -n 's/^-- //p' | while read -r pkgfile; do
echo "-> $pkgfile"
echo "== Scripts in @calcom/prisma =="
jq -r '.scripts' "$pkgfile" || cat "$pkgfile"
echo
echo "== Check presence of db-up/db-deploy/dx relationships =="
rg -nC2 -e '"db-up"\s*:' -e '"db-deploy"\s*:' -e '"dx"\s*:' "$pkgfile"
done
echo "== Cross-check any turbo references to @calcom/prisma#db-deploy =="
rg -n '@calcom/prisma#db-deploy' -C2
echo "== Who depends on @calcom/prisma#db-seed? =="
rg -nP '"dependsOn"\s*:\s*\[[^\]]*@calcom/prisma#db-seed[^\]]*\]' -n -C2 turbo.jsonLength of output: 220
It looks like the previous script didn’t locate any definitions for @calcom/prisma or the related DB scripts. Let’s try a more targeted search across all package.json files and re-examine turbo.json:
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
echo "== Locate @calcom/prisma package.json =="
for pkg in $(find . -name package.json); do
if jq -e '.name == "@calcom/prisma"' "$pkg" >/dev/null 2>&1; then
echo "-> $pkg"
echo "Scripts:"
jq '.scripts' "$pkg"
echo
fi
done
echo "== List any db-up or db-deploy scripts across all packages =="
for pkg in $(find . -name package.json); do
echo "-> $pkg"
jq -r '.scripts | to_entries[] | "\(.key): \(.value)"' "$pkg" \
| grep -E 'db-up|db-deploy' \
|| echo " (none)"
echo
done
echo "== Inspect turbo.json for db-deploy/db-seed refs =="
rg -n '@calcom/prisma#db-deploy|@calcom/prisma#db-seed' -C2 turbo.json || echo "(no matches)"Length of output: 71175
Restore transitive “DB up → deploy → seed” ordering to avoid CI/local race conditions
Our investigation confirms that:
-
In
packages/prisma/package.json, thedb-deployscript is defined as
"db-deploy": "yarn prisma migrate deploy"
but does not start the database (that’s whatdb-updoes).
(db-upisdocker compose up -d || docker-compose up -d) -
In
turbo.json, the@calcom/prisma#db-seedtarget now only depends on@calcom/prisma#db-deploy, dropping the previous transitive dependency ondb-up. As a result, any target (e.g.embed-tests-update-snapshots:ciat lines 224–231) that depends on@calcom/prisma#db-seedmay attempt to seed before the database is running.
Two safe fixes to re-establish the correct ordering:
• Preferred: make the db-deploy Turbo target depend on db-up, so all callers of db-deploy (and transitively db-seed) will first start the DB.
@@ turbo.json (around lines 7–12)
- "@calcom/prisma#db-deploy": {
- "inputs": ["./schema.prisma", "./migrations/**/*.sql"]
- },
+ "@calcom/prisma#db-deploy": {
+ "dependsOn": ["@calcom/prisma#db-up"],
+ "inputs": ["./schema.prisma", "./migrations/**/*.sql"]
+ },• Minimal: add db-up alongside db-deploy in the db-seed target.
@@ turbo.json (around lines 13–16)
- "dependsOn": ["@calcom/prisma#db-deploy"]
+ "dependsOn": ["@calcom/prisma#db-up", "@calcom/prisma#db-deploy"]Either change will restore the original “up → deploy → seed” flow and prevent seeding against a non-running DB.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "@calcom/prisma#db-seed": { | |
| "cache": false, | |
| "dependsOn": ["@calcom/prisma#db-migrate"] | |
| "dependsOn": ["@calcom/prisma#db-deploy"] | |
| }, | |
| "@calcom/prisma#db-seed": { | |
| "cache": false, | |
| "dependsOn": ["@calcom/prisma#db-up", "@calcom/prisma#db-deploy"] | |
| }, |
🤖 Prompt for AI Agents
In turbo.json around lines 13 to 16, the @calcom/prisma#db-seed target no longer
ensures the DB is started before deploy/seed, causing races; restore the
transitive ordering by either (preferred) adding a dependsOn entry so the
db-deploy target depends on @calcom/prisma#db-up (so all callers of db-deploy
implicitly start the DB first) or (minimal) add @calcom/prisma#db-up alongside
@calcom/prisma#db-deploy in the dependsOn array for @calcom/prisma#db-seed so
seed will wait for the DB to be up before running.
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (08/21/25)1 reviewer was added to this PR based on Keith Williams's automation. "Add community label" took an action on this PR • (08/21/25)1 label was added to this PR based on Keith Williams's automation. |
|
This should not be merged without @emrysal approval |
|
@emrysal can you please review this as i have to always add this modification to make this work |
volnei
left a comment
There was a problem hiding this comment.
Thank you for your contribution! LGTM!
E2E results are ready! |
|
Got confirmation from @emrysal |
Fix: #23252
Fixes the issue where 'yarn dx' fails in non-interactive environments (CI/CD, Docker, automated scripts) by changing Turbo dependencies:
This ensures that non-interactive 'prisma migrate deploy' is used instead of interactive 'prisma migrate dev', allowing yarn dx to work correctly in automated environments.

##Before
##After
