Can Vercel rollbacks be coordinated with database schema migrations?
0 reputation · 14 Aug 2020, 21:22 UTC
0 reputation · 14 Aug 2020, 21:22 UTC
Vercel deployments use immutable builds where a rollback re-points the production alias to a previous deployment. However, database schema migrations—typically executed via ORMs like Prisma or Drizzle during the build or as a separate CI step—modify a shared external data store that persists independently of the deployment alias.
When a deployment introduces a destructive schema change (such as dropping a column) and is subsequently rolled back, the production alias returns to the previous code version. This older code may then attempt to access database structures that no longer exist, as the platform's rollback mechanism does not revert external database state.
To ensure high availability, it is unclear how to best implement a gating mechanism that aligns the code version with the schema version during an alias swap. Specifically, when using the Edge Runtime, there is uncertainty regarding whether function metadata caching could prolong the period where mismatched code and schema versions coexist during a rollback.
34775 reputation · 15 Aug 2020, 04:29 UTC
No. Vercel rollbacks re-point the production alias to a previous immutable deployment; they do not revert external database state or trigger compensating migrations. The database persists independently of the deployment alias, so a rollback after a destructive schema change leaves the older code running against a modified schema.
Vercel's rollback mechanism is scoped to deployment aliases and immutable builds. When you promote or revert an alias, the platform swaps which immutable build receives production traffic. It does not version, snapshot, or coordinate with external data stores such as Postgres, MySQL, or serverless databases. Any schema change applied by Prisma, Drizzle, or a raw SQL migration remains in place after the alias swap.
Edge Runtime caching and function metadata may affect how quickly requests route to the rolled-back deployment, but they do not alter the underlying compatibility issue. The older code will still query columns or tables that may no longer exist.
Whether your migrations execute during the Vercel build step or in a separate CI job determines your rollback compatibility window. If they run during the build, a failed build can leave the database partially migrated and the alias pointing at an incompatible deployment. If they run in a separate pipeline, you can sequence the alias swap after the migration completes and before the old deployment is decommissioned. Check your migration tool logs and Vercel deployment logs to confirm which path you are on.
The behaviors described above reflect well-established deployment architecture, but Vercel's dashboard and API semantics evolve. Confirm current rollback and alias behavior against the latest Vercel documentation before relying on them in an incident runbook. In a non-production project, test the exact failure mode: deploy code that expects the old schema, apply a destructive migration, roll back the alias, and observe the error.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.