Skip to content

Comments

fix: Use db-deploy instead of db-migrate for yarn dx in non-interacti…#23253

Merged
anikdhabal merged 3 commits intocalcom:mainfrom
Vansh5632:fix/yarn-dx-prisma-migrate-clean
Sep 10, 2025
Merged

fix: Use db-deploy instead of db-migrate for yarn dx in non-interacti…#23253
anikdhabal merged 3 commits intocalcom:mainfrom
Vansh5632:fix/yarn-dx-prisma-migrate-clean

Conversation

@Vansh5632
Copy link
Contributor

Fix: #23252

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.
##Before
Screenshot from 2025-08-21 16-14-24

##After
image

…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
@vercel
Copy link

vercel bot commented Aug 21, 2025

@Vansh5632 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 21, 2025

Walkthrough

The 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

Objective Addressed Explanation
Prevent interactive Prisma migrate during yarn dx by removing dependency on db-migrate and using non-interactive targets (Issue #23252)
Ensure seeding uses a non-interactive migration/deployment step by switching dependency from db-migrate to a non-interactive alternative (Issue #23252)
Update turbo.json so yarn dx completes in non-interactive environments without migration prompts (Issue #23252)

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
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Aug 21, 2025
@graphite-app graphite-app bot requested a review from a team August 21, 2025 11:05
@github-actions github-actions bot added ❗️ migrations contains migration files 🐛 bug Something isn't working labels Aug 21, 2025
@dosubot dosubot bot added the ⬆️ dependencies Pull requests that update a dependency file label Aug 21, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 89a3b77 and 711a396.

📒 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: dx already includes non-interactive migrations

A look at packages/prisma/package.json shows:

  • dx runs yarn db-setup
  • db-setup runs db-up, then db-deploy (yarn prisma migrate deploy), then db-seed

Since dx invokes db-deploy under the hood, it already performs non-interactive migrations. You don’t need to add @calcom/prisma#db-deploy to the dependsOn list in turbo.json.

turbo.json Outdated
Comment on lines 13 to 16
"@calcom/prisma#db-seed": {
"cache": false,
"dependsOn": ["@calcom/prisma#db-migrate"]
"dependsOn": ["@calcom/prisma#db-deploy"]
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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-deploy depend on @calcom/prisma#db-up to 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-up alongside @calcom/prisma#db-deploy for db-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.json

Length 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, the db-deploy script is defined as
    "db-deploy": "yarn prisma migrate deploy"
    but does not start the database (that’s what db-up does).
    (db-up is docker compose up -d || docker-compose up -d)

  • In turbo.json, the @calcom/prisma#db-seed target now only depends on @calcom/prisma#db-deploy, dropping the previous transitive dependency on db-up. As a result, any target (e.g. embed-tests-update-snapshots:ci at lines 224–231) that depends on @calcom/prisma#db-seed may 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.

Suggested change
"@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-app
Copy link

graphite-app bot commented Aug 21, 2025

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.

@anikdhabal anikdhabal requested a review from volnei August 22, 2025 04:14
@keithwillcode
Copy link
Contributor

This should not be merged without @emrysal approval

@Vansh5632
Copy link
Contributor Author

@emrysal can you please review this as i have to always add this modification to make this work

Copy link
Contributor

@volnei volnei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! LGTM!

@volnei volnei self-requested a review September 3, 2025 21:30
@volnei volnei enabled auto-merge (squash) September 3, 2025 22:00
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

E2E results are ready!

@anikdhabal anikdhabal disabled auto-merge September 4, 2025 03:54
@anikdhabal anikdhabal enabled auto-merge (squash) September 10, 2025 03:08
@anikdhabal
Copy link
Contributor

Got confirmation from @emrysal

@anikdhabal anikdhabal merged commit 2cc8b1c into calcom:main Sep 10, 2025
56 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working community Created by Linear-GitHub Sync ⬆️ dependencies Pull requests that update a dependency file ❗️ migrations contains migration files ready-for-e2e size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issue with local setup when running yarn dx

4 participants