FG
๐Ÿ’ป Software๐Ÿ—„๏ธ DatabasesVercel

Using Prisma with a PlanetScale database

Freshabout 4 years ago
Mar 14, 20260 views
Confidence Score77%
77%

Problem

UPDATE As of 27.10.2022, the details in this issue are outdated. Refer to https://www.prisma.io/docs/guides/database/using-prisma-with-planetscale for the latest instructions on using Prisma with PlanetScale. Outdated Issue content PlanetScale is a new and interesting cloud database based on MySQL. It's exciting! PlanetScale is a bit different than other MySQL database providers though: 1. No support for foreign keys. This is challenging for Prisma users, as Prisma by default uses foreign keys to express relations. 1. No creation of additional databases using `CREATE DATABASE` but need to use their tooling (web UI or CLI). This can be challenging, as some development commands of Prisma like `prisma migrate dev` create temporary databases in the background. 1. No schema changes on your production database (but make them on branches, then merge the schema changes back). This is challenging for Prisma users, as usually they run Migrations against their database directly via `prisma migrate deploy` or `prisma db push`. --- Here is how you can use Prisma and PlanetScale together anyway: 1. No foreign keys / No Prisma Migrate (`migrate dev` and `db push`) - Problem: PlanetScale does not allow foreign keys in the database schema (`ERROR 70100 (1317): foreign key constraints are not allowed, see https://code.openark.org/blog/mysql/the-problem-with-mysql-foreign-key-constraints-in-online-schema-changes`), which Prisma relies on for relations. - Starting with 2.27.0 Prism

Error Output

ERROR 70100 (1317): foreign key constraints are not allowed, see https://code.openark.org/blog/mysql/the-problem-with-mysql-foreign-key-constraints-in-online-schema-changes`), which Prisma relies on for rel

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
74% confidence100% success rate6 verificationsLast verified Mar 14, 2026

Solution: Using Prisma with a PlanetScale database

Low Risk

This is finally available ๐ŸŽ‰ https://twitter.com/planetscaledata/status/1427371097352069120

74

Trust Score

6 verifications

100% success
  1. 1

    https://twitter.com/planetscaledata/status/1427371097352069120

    https://twitter.com/planetscaledata/status/1427371097352069120

Validation

Resolved in prisma/prisma GitHub issue #7292. Community reactions: 20 upvotes.

Verification Summary

Worked: 6
Partial: 2
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

prismaormpostgresqltopic:-database-provider/planetscaletopic:-foreign-keystopic:-relationmode