On this page
The overlap window
A migration can commit while an old instance is still serving traffic or finishing a request. Webhook handlers, workers and scheduled jobs may still read or write the shared database using the old schema. Testing the old app on the old schema and the new app on the new schema leaves this overlap untested.
A Stripe price write failed during the overlap
In two local replays, the old webhook failed after the migration and a price row was missing.
In Vercel’s Next.js Subscription Payments starter, commit a138bf79 removed description and metadata from public.prices. The previous webhook handler still included both fields in its upsert for price.created. Read the original commit.
With the migration already applied, the old upsert returned PGRST204 and its price row was missing at the end of both runs (2/2). The same request saved its row when it ran before the migration. The replay measured rows before any Stripe redelivery.
Three other commit pairs, CMSaasStarter, Nextbase and SvelteKit SPA, showed no defect in the orders tested.
Expand first, contract in a later release
For a removal-only change, deploy the new code with both columns still in place. Drop them after the old code drains.
For a replacement, add the new column as nullable while keeping the old one. Keep values in sync while either version can write, for example with a Postgres trigger for old writers. Backfill existing rows and verify the values match before switching reads. Wait until code that uses the legacy column can no longer run before dropping it.
For public.prices, deploy a webhook that leaves both fields out of its upsert. Once old handlers have finished and your rollback target works without the columns, apply the contract migration separately.
-- Contract only after the old code has drained.
ALTER TABLE public.prices
DROP COLUMN description,
DROP COLUMN metadata;Expand and contract checklist
- 1The local rollout check is coming. For now, list every reader and writer that touches the old fields, including webhooks, queue consumers, scheduled jobs and rollback targets.
- 2Test both app versions against the schema they share during the rollout. In a disposable database, apply the planned migration at the point it would run in production, send a representative request to each version and verify the expected rows by ID.
- 3Verify any backfill before switching reads. Include writes that arrive while the backfill runs.
- 4Drain old instances and in-flight work, then confirm your rollback target is compatible with the contracted schema. Apply the destructive migration separately and recheck writes on the new schema.
Related guides
Sources
Browse all launch guides · Read resources · How to make and check your next change
FAQ for builders before launch
Does switching all traffic to the new release end the overlap?
Check in-flight requests, background workers and webhook destinations separately. Each can still reach the shared database after traffic shifts.