Skip to main content

Documentation Index

Fetch the complete documentation index at: https://planetscale.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

What this error means

FOREIGN_KEYS_UNRESOLVED means Vitess could not resolve the dependency ordering for a table’s foreign keys. A common underlying message is:
table `posts` has unresolved foreign key dependencies

Why PlanetScale rejects it

PlanetScale needs to know the order in which tables and constraints can be applied. Foreign keys introduce dependencies between tables. If those dependencies are missing, conflicting, cyclic, or changed together in an unsafe order, Vitess cannot safely build the final schema.

How to fix it

Check the table named in the error and each foreign key it defines.
  • Confirm every referenced table exists in the final schema.
  • Confirm every referenced column exists and is indexed as required by MySQL.
  • Create parent tables before child constraints.
  • Drop child constraints before dropping referenced parent tables or columns.
  • Split dependent changes into separate deploy requests.
  • Break cycles where possible.
For example, deploy parent table changes first, then add child constraints in a later deploy request.

Need help?

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