Deploy requests now alert on potential unwanted changes
We’ve updated our Deploy Request UI to alert when a schema change could produce unintended changes
We’d like to share a little detail we just shipped to the Deploy Request UI. We now show you if your schema change could result in the loss of any data due to a dropped column or table.
We’re on a mission to make deploy requests the safest and least stressful way to make schema changes.
Earlier this year, we release an in-dashboard feature that lets you revert a production schema change with one click, all while keeping any data that was written in the meantime.
Now, with this small addition to the UI, we hope to further protect developers from mistakes by surfacing warnings straight on the deploy request page.
Inspired by a rename#
The inspiration for this feature primarily came from developer's experience renaming columns through PlanetScale. It was a common question that came up: how do I safely rename a column?
A rename is an unsafe operation when it comes to zero downtime deployments.
For a rename to work successfully, you'd have to deploy your schema change and code changes at exactly the same time. This is highly risky, if not impossible to get right.
In cases where you do want to do a rename, here’s the safe way:
- Create the new column
- Update your application to double write to both the old and new column
- Run a script to backfill old data
- Update your app to read from the new column
- Remove double writes
- You can now safely drop the old column
Each step is a deployment of your application. This is certainly a bit of extra work, but it’s the safest way to complete a rename without risk to production or having to take your application down.
You can give this a try today. Drop a table or column in a deploy request, and you’ll see you get alerted about the risky change.
If you have any feedback, we’d love to hear it. You can find us on Twitter or our GitHub discussion board.