惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
P
Proofpoint News Feed
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
C
Check Point Blog
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
美团技术团队
D
Docker
博客园 - Franky
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

Blog — PlanetScale

Keeping a Postgres queue healthy — PlanetScale Patterns for Postgres Traffic Control — PlanetScale Graceful degradation in Postgres — PlanetScale High memory usage in Postgres is good, actually — PlanetScale Stripe Projects partnership: Provision PlanetScale Postgres and MySQL databases from the Stripe CLI — PlanetScale Enhanced tagging in Postgres Query Insights — PlanetScale Behind the scenes: How Database Traffic Control works — PlanetScale Introducing Database Traffic Control — PlanetScale Scaling Postgres connections with PgBouncer — PlanetScale Drizzle joins PlanetScale — PlanetScale Video Conferencing with Postgres — PlanetScale Faster PlanetScale Postgres connections with Cloudflare Hyperdrive — PlanetScale Introducing the PlanetScale MCP server — PlanetScale Database Transactions — PlanetScale Automating our changelog with Cursor commands — PlanetScale Postgres 18 is now available — PlanetScale Using MotherDuck with PlanetScale — PlanetScale $50 PlanetScale Metal is GA for Postgres — PlanetScale AI-Powered Postgres index suggestions — PlanetScale $5 PlanetScale is live — PlanetScale Announcing Vitess 23 — PlanetScale $50 PlanetScale Metal — PlanetScale Report on our investigation of the 2025-10-20 incident in AWS us-east-1 — PlanetScale $5 PlanetScale — PlanetScale Benchmarking Postgres 17 vs 18 — PlanetScale Larger than RAM Vector Indexes for Relational Databases — PlanetScale Partnering with Cloudflare to bring you the fastest globally distributed applications — PlanetScale Processes and Threads — PlanetScale PlanetScale for Postgres is now GA — PlanetScale Postgres High Availability with CDC — PlanetScale
Announcing foreign key constraints support — PlanetScale
Taylor Barnett · 2023-12-05 · via Blog — PlanetScale

Taylor Barnett |

Today, we're adding support for foreign key constraints on PlanetScale!

We understand that making database changes can be a daunting task. Now, you can use PlanetScale without reworking your existing application or data model to remove foreign key constraints. You can also use PlanetScale out of the box with your favorite ORM or framework that uses foreign key constraints by default, no changes needed.

You no longer have to sacrifice foreign key constraints when using database branching, non-blocking schema changes with Online DDL, database imports, and scaling your database with PlanetScale.

What is a foreign key constraint?

A foreign key constraint is a database construct and implementation that enforces the integrity of foreign key relationships (referential integrity). Specifically, it ensures that a child table can only reference a parent table when the appropriate row exists in the parent table. This is not to be confused with foreign keys, which allow you to cross-reference related data across tables.

Developers should weigh the advantages and disadvantages of using foreign key constraints for their specific application, which are discussed further in the foreign key constraints documentation.

If you want a behind-the-scenes look into foreign key constraints in PlanetScale, read our blog post about the technical challenges of supporting foreign key constraints.

Foreign key constraints beta

Note

Update: Foreign key constraint support is now GA. You can enable foreign key constraint support in your database settings page.

The new foreign key constraints support is available today in beta on a per-database level for all unsharded databases. Sharded database support will come next year. When you opt in to the beta, we upgrade your Vitess cluster, and in some cases, we upgrade the MySQL version.

To opt in to an existing database, go to your database's "Settings" page and enroll on the "Beta features" page. Note: You must be an organization administrator to enroll in beta features.

On the database's "Overview" 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!

Warning

If you want to unenroll your database from the beta, make sure to first drop your foreign key constraints. We do not downgrade your database at this time.

Most users with newer databases can use foreign key constraints within minutes. Older databases may take longer.

If you have existing internet-accessible MySQL or MariaDB databases that use foreign key constraints, you can also now import them into PlanetScale using our database import tool.

For more details about the beta, see the foreign key constraints beta documentation.

Try it out today

We have tested the beta with various popular ORMs and frameworks, but if you experience any issues with your ORM or framework of choice, let us know! While we are in this beta phase, it is helpful to hear about any problems you experience using foreign key constraints in PlanetScale. Please contact us if you have anything to share or have any questions.