Enable foreign key constraints on a PlanetScale unsharded database

domain: planetscale.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Confirm your database is unsharded in the PlanetScale console (sharded databases do not support foreign keys).
  2. Open the database settings page and toggle 'Foreign key constraints' to enabled — this is a database-level flag GA since Feb 2024.
  3. Create a development branch and run your DDL to add `REFERENCES` clauses as you would in standard MySQL; PlanetScale validates them.
  4. Use a deploy request to merge the schema change to production — PlanetScale checks constraint integrity before applying.
  5. Verify constraints are enforced by attempting an insert that would violate the FK and confirming the error is returned.

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans