Skip to main content
A deploy request can fail before copying starts because it drops a constraint by a name that does not exist on the production table:
MySQL requires CHECK and FOREIGN KEY constraint names to be unique across the whole schema. Because an online schema change builds a copy of the table alongside the original, PlanetScale gives every constraint on the copy a new name: the original name plus a generated suffix such as orders_amount_chk_5vtaqz7kepok6wa91vryrkrje. The suffix changes every time the table goes through a deploy. See Foreign key constraint names change on every deployment. When the deploy runs, the DROP must name the constraint exactly as it exists on the production table at that moment. If the table was deployed again after this deploy request’s changes were computed, or the name recorded for the production branch is out of date, the names no longer match and the deploy stops.

How to fix it

Check the current name on the production branch:
Then open a new deploy request:
1
Close or cancel the failed deploy request.
2
Create a fresh branch from the production branch so it picks up the current constraint names.
3
Apply your schema change on the new branch and open a new deploy request.
If the new deploy request fails with the same error, contact support with the deploy request number.

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.