Skip to content


The latest PlanetScale features and product launches.

February 16, 2024

Foreign key constraints are now generally available

To enable foreign key constraints in any unsharded PlanetScale database, go to your database’s ”Settings” page and check the box to Allow foreign key constraints.

On the database’s ”Dashboard” page, you will see a loading spinner that says it is “Enabling foreign key constraints.” Once it no longer shows, you can use foreign key constraints in your PlanetScale database!

For most cases, foreign key constraints should work as expected in PlanetScale. There are a few cases to be aware of that are unsupported or result in less ideal behavior. You can read more in the limitations section of the foreign key constraints documentation.

If you don’t have an existing PlanetScale database and have an existing internet-accessible MySQL or MariaDB databases that use foreign key constraints, you can also import it into PlanetScale using our database import tool.

View full documentation