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_DISALLOWED means the schema contains a FOREIGN KEY constraint, but the database is not configured to allow foreign key constraints.
A common error message is:
Why PlanetScale rejects it
PlanetScale databases can run with foreign key constraints disabled or managed. When constraints are disabled, Vitess rejects DDL that creates them so the database does not enter a mixed or unsupported foreign key mode.How to fix it
Choose one of these approaches:- Enable foreign key constraint support for the database if your workload needs database-enforced referential integrity and the database meets the prerequisites.
- Remove the
CONSTRAINT ... FOREIGN KEYclause and keep ordinary indexes for query performance. - Enforce referential integrity in application code or background jobs instead of with database constraints.
Related docs
- Foreign key constraints
- Operating without foreign key constraints
- Strategies for maintaining referential integrity

