Skip to main content
A deploy request can fail before copying starts because a foreign key constraint references columns on the parent table that are not covered by a unique key:
MySQL 8.0 allowed a foreign key to reference any indexed column, even when the index was not unique or the foreign key covered only a prefix of it. MySQL 8.4 rejects both by default. The referenced columns must be the PRIMARY KEY or a UNIQUE key on exactly those columns.

How to fix it

Add a unique key on the referenced columns of the parent table, then deploy again:
If the referenced column is not unique by design, point the foreign key at the parent table’s primary key instead, or drop the constraint and enforce the relationship in your application. See Strategies for maintaining referential integrity. Make the change on your branch, then open a new deploy request. If the failed deploy is still in progress, cancel it first.

Need help?

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