LogoLogo
  • 👋Cal.com Handbook
  • The Company
    • ❓What is Cal.com?
    • 📈Mission, Vision and Values
    • 🅰️Glossary
    • 📈Organization Chart
  • HR & Careers
    • 👷Contract-to-hire trials
    • 🛫Onboarding
    • 🏆IC Levels
      • ⛰️Engineering Levels
        • 🕵️IC1 Engineer (Code Cadet)
        • 👷‍♀️IC2 Engineer (Code Craftsperson)
        • 🧘‍♀️IC3 Engineer (Code Connoisseur)
        • 🧙‍♂️IC4 Engineer (Code Wizard)
    • 💡Sharing your views
    • 💸Bonus & Equity Structure
  • Policies
    • 🏖️Vacations
    • 💳Expenses
    • 🗣️Communications
  • Engineering
    • 🔔Managing Notifications
    • ⭐Valuable Bookmarks
    • 🐛How to report issues
    • 💻How we work on Tickets
    • 🔥What to do during Emergencies
    • ✅PR Reviews
    • ☑️Self-reviews
    • 📚Keeping Docs up-to-date
    • 🌐HTTPS & Subdomains
    • 🎯Best practices
      • Data fetching
      • Avoid Prop Drilling
      • Prefer defaultHandler for simple API handlers
      • Prefer inferred types over explicit ones
      • Prefer early returns
      • Avoid comparing multiple values with `includes`
      • Validate using zod instead of type casting
      • Prefer Composition over Prop Drilling
      • Prefer ternaries over Short Circuiting “&&” for React Components
      • Don't modularize prematurely
      • Only select data you need
      • Disallowing the use of unrestricted Metadata fields
      • E2E Tests Best Practices
    • 💻Codebase
      • 🔓Keeping the lock file in sync
      • 🚫Git Private Submodules
      • 🏎️Monorepo / Turborepo
      • 🌝Deploying to Production
      • ☁️Deployment
      • 💻Debug Desktop App
      • 🚩Enabling/Disabling Features
    • 🔺Resolving failed migration on Vercel Preview
    • 🔦Cal.com Status Page
  • Customer Success
    • 💟Tone
  • Marketing
    • 🎬Media
    • ☝️How to add a new Tip to Sidebar
  • 🤲Sales
    • Operations Stack
Powered by GitBook
On this page

Was this helpful?

  1. Engineering

Resolving failed migration on Vercel Preview

PreviousEnabling/Disabling FeaturesNextCal.com Status Page

Last updated 1 year ago

Was this helpful?

We currently use a single DB for all preview deployments corresponding to various branches. (There is on going work to have different DB per branch. This approach would still remain applicable as repeat deployments of same branch would fail.)

Sometimes, a faulty migration in one of those in progress branches, can fail which can start failing all builds of other branches as well.

Steps to fix the issue

  • Get the name of the failed migration(e.g. in the above case it is 20220714175322_destination_calendar_one_to_many_bookings)

  • Go to prisma folder in the repo. Modify DATABASE_URL temporarily to Preview DB. You can get the credentials from Vercel Environment Variables(Preview). It might be a good idea to have that variable remain there as commented, so that you can easily switch

  • Once, you have ensured that, DATABASE_URL is updated, run following command from prisma folder yarn prisma migrate resolve --rolled-back 20220714175322_destination_calendar_one_to_many_bookings. This should fix the rollback the failed migration ensuring all other branches deploy fine.

  • Note that the branch having the issue should fix the migration problem to avoid this issue from coming again and again.

🔺
A sample failure on Vercel build.